Clean up some git and vim cruft

This commit is contained in:
Daniel Flanagan 2019-02-04 01:43:53 -06:00
parent 9d7d16d5cd
commit 12d479d22e
11 changed files with 125 additions and 136 deletions

View file

@ -7,7 +7,7 @@
[core]
editor = nvim
pager = nvim -c 'silent %sm/\\e.\\{-}m//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' -c 'goto 1' -
pager = less -r
[http "https://gopkg.in"]
followRedirects = true
@ -33,3 +33,7 @@
[push]
default = current
[pager]
branch = false
diff = nvim -c 'silent %sm/\\e.\\{-}m//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' -c 'goto 1' -

View file

@ -21,10 +21,10 @@ if has('nvim')
tnoremap <C-w> <C-\><C-n>:q!<CR>
" moving between terminal splits
" tnoremap <C-h> <C-\><C-n><C-w>h
" tnoremap <C-j> <C-\><C-n><C-w>j
" tnoremap <C-k> <C-\><C-n><C-w>k
" tnoremap <C-l> <C-\><C-n><C-w>l
tnoremap <C-h> :TmuxNavigateLeft<CR>
tnoremap <C-j> :TmuxNavigateDown<CR>
tnoremap <C-k> :TmuxNavigateUp<CR>
tnoremap <C-l> :TmuxNavigateRight<CR>
endif
" enter insert mode when entering a terminal buffer
@ -51,25 +51,28 @@ function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
let stepvalue = a:fwd ? 1 : -1
while (line > 0 && line <= lastline)
let line = line + stepvalue
if ( ! a:lowerlevel && indent(line) == indent ||
\ a:lowerlevel && indent(line) < indent)
if ( a:lowerlevel == 0 && indent(line) == indent ||
\ a:lowerlevel == 1 && indent(line) < indent ||
\ a:lowerlevel == -1 && indent(line) > indent)
if (! a:skipblanks || strlen(getline(line)) > 0)
if (a:exclusive)
let line = line - stepvalue
endif
exe line
exe 'normal ' column . '|'
exe 'normal ' (column+1) . '|'
return
endif
endif
endwhile
endfunction
" Moving back and forth between lines of same or lower indentation.
" moving back and forth between lines of same or lower indentation should be sane
nnoremap <silent> [l :call NextIndent(0, 0, 0, 1)<CR>
nnoremap <silent> ]l :call NextIndent(0, 1, 0, 1)<CR>
nnoremap <silent> [L :call NextIndent(0, 0, 1, 1)<CR>
nnoremap <silent> ]L :call NextIndent(0, 1, 1, 1)<CR>
nnoremap <silent> [<C-l> :call NextIndent(0, 0, -1, 1)<CR>
nnoremap <silent> ]<C-l> :call NextIndent(0, 1, -1, 1)<CR>
vnoremap <silent> [l <Esc>:call NextIndent(0, 0, 0, 1)<CR>m'gv''
vnoremap <silent> ]l <Esc>:call NextIndent(0, 1, 0, 1)<CR>m'gv''
vnoremap <silent> [L <Esc>:call NextIndent(0, 0, 1, 1)<CR>m'gv''
@ -82,27 +85,15 @@ onoremap <silent> ]L :call NextIndent(1, 1, 1, 1)<CR>
" run make with leader,m
nnoremap <leader>m :call RunMake()<CR>
" show project viewer with leader,n
nnoremap <leader>n :call OpenProjectViewer()<CR>
" change buffers with leader,tab
nnoremap <leader><Tab> :bnext<CR>
nnoremap <leader><S-Tab> :bprevious<CR>
" show project viewer with leader,n or C-n
nnoremap <C-n> :call NERDProjectViewer()<CR>
nnoremap <leader>n :call NERDProjectViewer()<CR>
" don't kill vim
" REBIND
nnoremap <leader>K <Nop>
nnoremap <S-K> <NOP>
" nerdtree
nnoremap <C-n> :NERDTree<CR>
" run macro across visually selected lines
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo '@'.getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
" quick paragraph formatting
vmap Q gq
nmap Q gqap
@ -131,14 +122,14 @@ nnoremap <leader>j :bprevious<CR>
nnoremap <C-k> :bnext<CR>
nnoremap <C-j> :bprevious<CR>
" change buffers with leader,tab
nnoremap <leader><Tab> :bnext<CR>
nnoremap <leader><S-Tab> :bprevious<CR>
" fast word change
nnoremap <leader>c ciw
nnoremap <leader>C ciW
" bash-like deletion
inoremap <C-BS> <C-w>
inoremap <A-BS> <C-w>
" clear search higlight
nnoremap <leader>/ :let @/ = ""<CR>:<BACKSPACE>
@ -158,7 +149,7 @@ nnoremap k gk
vnoremap j gj
vnoremap k gk
" camel case movements
" camel case motions
map <silent> ,w <Plug>CamelCaseMotion_w
map <silent> ,b <Plug>CamelCaseMotion_b
map <silent> ,e <Plug>CamelCaseMotion_e
@ -170,14 +161,6 @@ xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie
" a _ objects
" omap <silent> aw <Plug>CamelCaseMotion_aw
" xmap <silent> aw <Plug>CamelCaseMotion_aw
omap <silent> ab <Plug>CamelCaseMotion_ab
xmap <silent> ab <Plug>CamelCaseMotion_ab
omap <silent> ae <Plug>CamelCaseMotion_ae
xmap <silent> ae <Plug>CamelCaseMotion_ae
" remove trailing whitespace
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
@ -185,20 +168,17 @@ map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
nnoremap <silent> <leader>w :bd<CR>
" toggle spell checking:
map <F5> :setlocal spell!<CR>
map <F4> :setlocal spell!<CR>
" open urls, files, etc. example: http://google.com:
noremap <leader>o :!xdg-open <cfile><CR><CR>
" run `make run`
nnoremap <leader>R :ProjectRootExe !make run<cfile><CR><CR>
" insert newline
" doesn't work in terminals?
" NOTE: doesn't work in terminals?
" noremap <S-Enter> i<Enter><Esc>
" noremap <C-o> i<Enter><Esc>
" keep that dumb window from popping up (wild something or another)
" prevent wildmenu
map q: :q
noremap qqq: q:
@ -214,7 +194,8 @@ cnoremap <c-p> <up>
xnoremap < <gv
xnoremap > >gv
nmap ga <Plug><EasyAlign>
xmap ga <Plug><EasyAlign>
" distraction-free mode
nnoremap <silent> <Leader>df :DistractionFreeMode<CR>
" recalc syntax highlighting
nnoremap <leader>gs :syntax sync fromstart<CR>

View file

@ -12,19 +12,13 @@ hi LeadingWhiteSpaces ctermfg=black ctermbg=black
:command! ShowSpaceIndents call ShowSpaceIndentation()
:command! HideSpaceIndents call HideSpaceIndentation()
" allows for manual and syntax folding... supposedly
augroup vimrc
au BufReadPre * setlocal foldmethod=indent
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
augroup END
" jump to last opened position in file except in git commits
let jump_to_pos_blacklist = ['gitcommit']
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif
endif
" terminal split in neovim
" terminal split in neovim even tho we tmux
if has('nvim')
function! TerminalSplit()
let current_file = @%
@ -40,7 +34,7 @@ if has('nvim')
endfunction
endif
" Make any necessary directories in the path when saving a file
" make any necessary directories in the path when saving a file
fun! <SID>AutoMakeDirectory()
let s:directory = expand("<afile>:p:h")
if !isdirectory(s:directory)
@ -49,6 +43,7 @@ fun! <SID>AutoMakeDirectory()
endfun
autocmd BufWritePre,FileWritePre * :call <SID>AutoMakeDirectory()
" run make from vim smartly
if !exists("g:make_args")
let g:make_args="default"
endif
@ -68,7 +63,7 @@ endfun
" kill the terminal buffer when the process exits
autocmd TermClose * call feedkeys('<cr>')
fun! OpenProjectViewer()
fun! NERDProjectViewer()
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
execute 'NERDTree' path
endfun

View file

@ -1,3 +1,2 @@
let b:ale_fixers = ['mix_format']
let g:ale_elixir_elixir_ls_release = '/home/daniel/code/open-source/elixir-ls/release'

View file

@ -1 +1,2 @@
let g:neomake_markdown_enabled_makers = []
autocmd BufNewFile,BufReadPost *.md setl filetype=markdown spell

View file

@ -1 +1,2 @@
let b:ale_fixers = ['prettier', 'eslint']
autocmd FileType vue syntax sync fromstart

View file

@ -24,34 +24,34 @@ else
let g:prosession_dir = '~/.config/nvim/session/'
endif
Plug 'junegunn/vim-plug' " plugin manager should manage itself
Plug 'vim-airline/vim-airline' " status line
Plug 'vim-airline/vim-airline-themes' " more minimal status line
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
Plug 'w0rp/ale' " syntax checker
Plug 'SirVer/ultisnips'
Plug 'junegunn/vim-plug' " plugin manager should manage itself
Plug 'vim-airline/vim-airline' " status line
Plug 'vim-airline/vim-airline-themes' " more minimal status line
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
Plug 'w0rp/ale' " syntax checker
Plug 'SirVer/ultisnips' " snippet manager
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
Plug 'tpope/vim-commentary' " toggle comments in code easily
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux
Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux
Plug 'godlygeek/tabular' " align text
Plug 'lytedev/vim-superman' " view man pages with vim
Plug 'tpope/vim-surround' " quickly modify text surrounding objects
Plug 'tpope/vim-speeddating' " vim knows about date-like text objects
Plug 'tpope/vim-fugitive' " vim git commands
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
Plug 'wellle/targets.vim' " adds some more handy text objects
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
Plug 'junegunn/goyo.vim' " better distraction-free editing
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']}
Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']}
Plug 'junegunn/vim-peekaboo'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-eunuch'
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
Plug 'tpope/vim-commentary' " toggle comments in code easily
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux
Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux
Plug 'godlygeek/tabular' " align text
Plug 'lytedev/vim-superman' " view man pages with vim
Plug 'tpope/vim-surround' " quickly modify text surrounding objects
Plug 'tpope/vim-speeddating' " vim knows about date-like text objects
Plug 'tpope/vim-fugitive' " vim git commands
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
Plug 'wellle/targets.vim' " adds some more handy text objects
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
Plug 'junegunn/goyo.vim' " better distraction-free editing
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language
Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language
Plug 'junegunn/vim-peekaboo' " preview registers
Plug 'scrooloose/nerdtree' " file browser
Plug 'tpope/vim-eunuch' " unix helper commands

View file

@ -5,6 +5,8 @@ let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffer
let g:airline#extensions#tabline#fnamemod = ':t'
" set laststatus=2 " always show statusline
" set noshowmode " hides default mode
" cleanup/simplify airline
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline_right_alt_sep = ''
@ -13,11 +15,14 @@ let g:airline_left_alt_sep= ''
let g:airline_left_sep = ''
let g:airline#extensions#tabline#buffers_label = ''
" short mode texts
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'T' : 'T',
\ 't' : 'T',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
@ -30,8 +35,7 @@ let g:airline_mode_map = {
let g:indent_guide_auto_colors = 1
let g:indent_guides_enable_on_vim_startup = 1
let g:ale_elixir_elixir_ls_release = '/home/daniel/code/open-source/elixir-ls/release'
" no ALE gutter
let g:ale_sign_column_always = 0
let g:ale_set_signs = 0
highlight clear ALEErrorSign
@ -39,11 +43,14 @@ highlight clear ALEWarningSign
let g:fzf_layout = { 'window': 'enew' }
set completeopt=noinsert,menuone,noselect,longest,preview
" ALE completeopt recommendation
set completeopt=menu,menuone,preview,noselect,noinsert
" set completeopt=noinsert,menuone,noselect,longest,preview
" fix neovim cursor
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1
" fix me, baby
let g:ale_fix_on_save = 1
" line number defaults
@ -59,7 +66,7 @@ set norelativenumber
" set norelativenumber " line numbers
" endif
" use tabs at a two-space width
" use tabs at a two-space width like God intended
set tabstop=2
set shiftwidth=2
set softtabstop=2
@ -84,41 +91,44 @@ set formatoptions=crql1j " :h fo-table
" handle window title
set title
" don't do syntax highlighting on lines longer than 2048 characters
set synmaxcol=2048
" limit syntax highlighting line length
set synmaxcol=500
" don't highlight the current line
set nocursorline
" set cursorcolumn " highlight the current column
" let &colorcolumn=join(range(81,400),",") " colors columns past 80
" don't highlight the current column
" set nocursorcolumn
" OBSOLETE: colors columns past 80
" let &colorcolumn=join(range(81,400),",")
" highlight the 81st character in a line where it exists
highlight ColorColumn ctermbg=magenta ctermfg=7
call matchadd('ColorColumn', '\%81v', 100)
set noshowcmd
set nowildmenu
set wildmode=longest,list,full
set cpoptions-=$
set showmatch
set mouse=a
set mousehide
set backspace=indent,eol,start
set noruler
set lazyredraw
set scrolloff=8
set sidescrolloff=8
set splitright
set splitbelow
set noerrorbells
set visualbell
set nobackup
set nowritebackup
set noswapfile
set timeout
set ttimeoutlen=200
set isfname+=32
" set noshowcmd
" set nowildmenu
" set wildmode=longest,list,full
set cpoptions-=$ " make buffer options more global
set noshowmatch " don't briefly highlight matching brackets
set mouse=a " enable mouse use
set mousehide " hide mouse when typing
set backspace=indent,eol,start " sane backspace
set noruler " hide the ruler - we have airline
set lazyredraw " don't draw during macros and other such things
set scrolloff=8 " keep lines above and below cursor (padding)
set sidescrolloff=15 " same but for columns
set splitright " don't split left
set splitbelow " don't split top
set noerrorbells " shhhh, vim
set visualbell " but visual noise for alerts is ok
set nobackup " sessions handle this quite nicely
set nowritebackup " no but really they do
set noswapfile " no seriously sessions are cool
set timeout " key combo mapping timeout
set ttimeoutlen=200 " ms for key combo mapping timeout
set isfname+=32 " allow filenames to show them 32s
" no freakin' bell
set visualbell t_vb=
@ -144,7 +154,7 @@ highlight GitGutterChangeDelete ctermbg=black guibg=black
hi NonText ctermfg=black guifg=black
set hidden " allows buffer switching without saving
set shortmess=Ia
set shortmess=Ia " hide vim intro, skip lots of file messages/prompts
set history=1000
" undo files
@ -153,40 +163,36 @@ set undodir=$vimdir/undo
set undolevels=1000
set undoreload=10000
" backup files
set backupdir=$vimdir/backup
set directory=$vimdir/backup
" spell file
set spellfile=$vimdir/spell/en.utf-8.add
" smart case insensitivity by default
" more sane search settings
set ignorecase
set smartcase
set incsearch
set hlsearch
set wrapscan
" highlight search matches
set hlsearch
" enable syntax folding
set foldmethod=syntax
set foldlevel=99
set foldnestmax=10
set foldlevelstart=0
set autowrite
set autochdir
set autoread
set nomodeline
set noshowmode
set noshowcmd
set noautowrite " let me do the writing
set autochdir " `:e` all day
set autoread " this is fine with `u`
set nomodeline " airline wins
set noshowmode " airline is really good
set noshowcmd " be clean
set laststatus=0
set laststatus=0 " be clean
" yank to OS clipboard
" yank to OS clipboard by default
set clipboard+=unnamedplus
set nofoldenable
setlocal nofoldenable
" no empty buffer on startup
augroup DisableEmptyBuffer
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif

View file

@ -30,7 +30,7 @@ URxvt*utf8: 1
URxvt*scaleHeight: 1
URxvt*depth: 32
URxvt*internalBorder: 24
URxvt*perl-ext-common: default,matcher,resize-font,config-reload
URxvt*perl-ext-common: default,matcher,resize-font
URxvt*keysym.M-Escape: perl:keyboard-select:activate
URxvt*resize-font.smaller: C-Down
URxvt*resize-font.bigger: C-Up

View file

@ -55,6 +55,8 @@ alias tcom="tmux attach -t comms || tmux new -s comms"
# TODO: make these git aliases in the gitconfig?
alias g="git"
alias gs="git status"
alias gd="git diff"
alias gdv="git dv"
alias gpl="git pull"
alias gp="git push"
alias gpa="git push --all && git push --tags"