diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/html/lint.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/html/tidy.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/html/url_link.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/check.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/lint.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/tidy.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/php/check.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/sh/check.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/sh/lint.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/vim/lint.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/zsh/check.vim | 9 | ||||
m--------- | vim/bundle/diff_prune | 0 | ||||
m--------- | vim/bundle/fixed_join | 0 | ||||
m--------- | vim/bundle/redact_pass | 0 | ||||
-rw-r--r-- | vim/filetype.vim | 10 | ||||
-rw-r--r-- | vim/ftplugin/markdown.vim | 6 | ||||
-rw-r--r-- | vim/indent/password.vim | 11 | ||||
-rw-r--r-- | vim/vimrc | 52 |
20 files changed, 75 insertions, 110 deletions
diff --git a/.gitmodules b/.gitmodules index 30a58edc..dd10f0e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,6 +8,9 @@ [submodule "vim/bundle/copy_linebreak"] path = vim/bundle/copy_linebreak url = https://sanctum.geek.nz/code/vim-copy-linebreak.git +[submodule "vim/bundle/diff_prune"] + path = vim/bundle/diff_prune + url = https://sanctum.geek.nz/code/vim-diff-prune.git [submodule "vim/bundle/fixed_join"] path = vim/bundle/fixed_join url = https://sanctum.geek.nz/code/vim-fixed-join.git @@ -1,2 +1,2 @@ -tejr dotfiles v1.0.0 -Sat Jun 23 03:02:16 UTC 2018 +tejr dotfiles v1.1.0 +Sun Jun 24 21:02:03 UTC 2018 diff --git a/vim/after/ftplugin/html/lint.vim b/vim/after/ftplugin/html/lint.vim index 0b56e73c..9ab479c0 100644 --- a/vim/after/ftplugin/html/lint.vim +++ b/vim/after/ftplugin/html/lint.vim @@ -31,12 +31,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('tidy')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>HtmlLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>HtmlLint') - nmap <buffer> <unique> - \ <LocalLeader>l - \ <Plug>HtmlLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>l' -endif diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim index 3faefcb7..9331486b 100644 --- a/vim/after/ftplugin/html/tidy.vim +++ b/vim/after/ftplugin/html/tidy.vim @@ -31,12 +31,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call filter#Stable('tidy -quiet')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>HtmlTidy' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>HtmlTidy') - nmap <buffer> <unique> - \ <LocalLeader>t - \ <Plug>HtmlTidy - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>t' -endif diff --git a/vim/after/ftplugin/html/url_link.vim b/vim/after/ftplugin/html/url_link.vim index 1cf57a7b..e7263e17 100644 --- a/vim/after/ftplugin/html/url_link.vim +++ b/vim/after/ftplugin/html/url_link.vim @@ -47,12 +47,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call <SID>HtmlUrlLink()<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>HtmlUrlLink' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>HtmlUrlLink') - nmap <buffer> <unique> - \ <LocalLeader>r - \ <Plug>HtmlUrlLink - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>r' -endif diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim index f6f99f08..c810c91f 100644 --- a/vim/after/ftplugin/perl/check.vim +++ b/vim/after/ftplugin/perl/check.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('perl')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>PerlCheck') - nmap <buffer> <unique> - \ <LocalLeader>c - \ <Plug>PerlCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>c' -endif diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim index eaa6684c..86741f79 100644 --- a/vim/after/ftplugin/perl/lint.vim +++ b/vim/after/ftplugin/perl/lint.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('perlcritic')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>PerlLint') - nmap <buffer> <unique> - \ <LocalLeader>l - \ <Plug>PerlLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>l' -endif diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim index 64f0eda2..c815aba9 100644 --- a/vim/after/ftplugin/perl/tidy.vim +++ b/vim/after/ftplugin/perl/tidy.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call filter#Stable('perltidy')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlTidy' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>PerlTidy') - nmap <buffer> <unique> - \ <LocalLeader>t - \ <Plug>PerlTidy - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>t' -endif diff --git a/vim/after/ftplugin/php/check.vim b/vim/after/ftplugin/php/check.vim index 9dc4c6a8..ea88d39b 100644 --- a/vim/after/ftplugin/php/check.vim +++ b/vim/after/ftplugin/php/check.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('php')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PhpCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>PhpCheck') - nmap <buffer> <unique> - \ <LocalLeader>c - \ <Plug>PhpCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>c' -endif diff --git a/vim/after/ftplugin/sh/check.vim b/vim/after/ftplugin/sh/check.vim index 499926f3..48bb72d0 100644 --- a/vim/after/ftplugin/sh/check.vim +++ b/vim/after/ftplugin/sh/check.vim @@ -35,12 +35,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make(b:sh_check_compiler)<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ShCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>ShCheck') - nmap <buffer> <unique> - \ <LocalLeader>c - \ <Plug>ShCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>c' -endif diff --git a/vim/after/ftplugin/sh/lint.vim b/vim/after/ftplugin/sh/lint.vim index 65fe003d..a24ba369 100644 --- a/vim/after/ftplugin/sh/lint.vim +++ b/vim/after/ftplugin/sh/lint.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('shellcheck')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ShLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>ShLint') - nmap <buffer> <unique> - \ <LocalLeader>l - \ <Plug>ShLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>l' -endif diff --git a/vim/after/ftplugin/vim/lint.vim b/vim/after/ftplugin/vim/lint.vim index bd8c1da4..b71a7275 100644 --- a/vim/after/ftplugin/vim/lint.vim +++ b/vim/after/ftplugin/vim/lint.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('vint')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>VimLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>VimLint') - nmap <buffer> <unique> - \ <LocalLeader>l - \ <Plug>VimLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>l' -endif diff --git a/vim/after/ftplugin/zsh/check.vim b/vim/after/ftplugin/zsh/check.vim index 3e5ad7c6..a439ef8d 100644 --- a/vim/after/ftplugin/zsh/check.vim +++ b/vim/after/ftplugin/zsh/check.vim @@ -26,12 +26,3 @@ nnoremap <buffer> <silent> <unique> \ :<C-U>call compiler#Make('zsh')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ZshCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('<Plug>ZshCheck') - nmap <buffer> <unique> - \ <LocalLeader>c - \ <Plug>ZshCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <LocalLeader>c' -endif diff --git a/vim/bundle/diff_prune b/vim/bundle/diff_prune new file mode 160000 +Subproject aa15f28018e5f946f807e6b6e50a20fab4e0e95 diff --git a/vim/bundle/fixed_join b/vim/bundle/fixed_join -Subproject cc22b03e28dbe86c14c2e2f6fa17738b708dfb8 +Subproject f4564785ea7538d91a9400d082fea4ba8eed8ac diff --git a/vim/bundle/redact_pass b/vim/bundle/redact_pass -Subproject 8c35dddc4261bc6b0a03c4eb2b2158e47f37fa9 +Subproject ee516369f3ce613ad3160afa96fe0bfa8dd1aed diff --git a/vim/filetype.vim b/vim/filetype.vim index 6c40dec1..d5c9bdb8 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -144,6 +144,10 @@ augroup filetypedetect \,.gitmodules \,gitconfig \ setfiletype gitconfig + " Git rebase manifests + autocmd BufNewFile,BufRead + \ git-rebase-todo + \ setfiletype gitrebase " GnuPG configuration files autocmd BufNewFile,BufRead \ *gnupg/options @@ -246,6 +250,12 @@ augroup filetypedetect \,?*.[1-9] \,*/man[1-9]*/?*.[1-9]* \ setfiletype nroff + " pass(1) password files + autocmd BufNewFile,BufRead + \ /dev/shm/pass.?*/?*.txt + \,$TMPDIR/pass.?*/?*.txt + \,/tmp/pass.?*/?*.txt + \ setfiletype password " UNIX password and shadow files autocmd BufNewFile,BufRead \ /etc/passwd diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim index c6a180a9..e1787df5 100644 --- a/vim/ftplugin/markdown.vim +++ b/vim/ftplugin/markdown.vim @@ -20,9 +20,9 @@ setlocal formatoptions+=tcqln setlocal formatoptions-=ro " Set list format patterns -if exists('+option-name') - let &l:formatlistpat = '^\s*\d\+\.\s\+\' - \ .'\|^[-*+]\s\+\' +if exists('+formatlistpat') + let &l:formatlistpat = '^\s*\d\+\.\s\+' + \ .'\|^[-*+]\s\+' \ .'\|^\[^\ze[^\]]\+\]:' endif diff --git a/vim/indent/password.vim b/vim/indent/password.vim new file mode 100644 index 00000000..e633fe05 --- /dev/null +++ b/vim/indent/password.vim @@ -0,0 +1,11 @@ +" Only do this when not done yet for this buffer +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +" Manual indenting and literal tabs +setlocal noautoindent +setlocal noexpandtab +setlocal softtabstop=0 +let b:undo_indent = 'setlocal autoindent< expandtab< softtabstop<' @@ -192,6 +192,9 @@ nnoremap ]c :<C-U>cnext<CR> " Cycle through location list items nnoremap [l :<C-U>lprevious<CR> nnoremap ]l :<C-U>lnext<CR> +" Cycle through tabs +nnoremap [t :<C-U>tabprevious<CR> +nnoremap ]t :<C-U>tabnext<CR> " Insert blank lines around current line nmap [<Space> <Plug>PutBlankLinesAbove @@ -212,12 +215,6 @@ if has('digraphs') digraph 8: 9731 " SNOWMAN U+2603 endif -" Use different keys for global and local leaders -if 1 - let g:mapleader = '\' - let g:maplocalleader = '_' -endif - " Normal mode leader mappings below; use a literal backslash rather than " <Leader> so that the non-plugin mappings work on vim-tiny @@ -237,6 +234,8 @@ if has('unix') endif " \f shows the current 'formatoptions' at a glance nnoremap \f :<C-U>set formatoptions?<CR> +" \g changes directory to the current file's location +nnoremap \g :<C-U>cd %:h<CR>:pwd<CR> " \h toggles highlighting search results nnoremap \h :<C-U>set hlsearch! hlsearch?<CR> " \i toggles showing matches as I enter my pattern @@ -267,6 +266,47 @@ nmap \x <Plug>StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :<C-U>setlocal spelllang=en_nz spelllang?<CR> +" Use underscore for a local leader, for any plugins that use the variable +if 1 + let g:maplocalleader = '_' +endif + +" Filetype-specific mappings below; use a literal underscore rather than +" <LocalLeader> to keep the commands short +if has('autocmd') && v:version >= 700 + augroup vimrc_filetype_mappings + autocmd! + + " Diff: prune sections + autocmd FileType diff nmap <buffer> _p <Plug>DiffPrune + autocmd FileType diff xmap <buffer> _p <Plug>DiffPrune + + " HTML: lint, URL-to-link, tidy + autocmd FileType html nmap <buffer> _l <Plug>HtmlLint + autocmd FileType html nmap <buffer> _r <Plug>HtmlUrlLink + autocmd FileType html nmap <buffer> _t <Plug>HtmlTidy + + " Perl: check, lint, and tidy + autocmd FileType perl nmap <buffer> _c <Plug>PerlCheck + autocmd FileType perl nmap <buffer> _l <Plug>PerlLint + autocmd FileType perl nmap <buffer> _t <Plug>PerlTidy + + " PHP: check + autocmd FileType php nmap <buffer> _c <Plug>PhpCheck + + " Shell: check and lint + autocmd FileType sh nmap <buffer> _c <Plug>ShCheck + autocmd FileType sh nmap <buffer> _l <Plug>ShLint + + " VimL: lint + autocmd FileType vim nmap <buffer> _l <Plug>VimLint + + " Zsh: check + autocmd FileType zsh nmap <buffer> _c <Plug>ZshCheck + + augroup END +endif + " Add packaged matchit.vim, if supported if has('packages') packadd! matchit |