diff options
Diffstat (limited to 'vim/after')
-rw-r--r-- | vim/after/ftplugin/gitcommit.vim | 16 | ||||
-rw-r--r-- | vim/after/ftplugin/html.vim | 2 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 16 | ||||
-rw-r--r-- | vim/after/ftplugin/python.vim | 35 | ||||
-rw-r--r-- | vim/after/ftplugin/vim.vim | 6 | ||||
-rw-r--r-- | vim/after/indent/vim.vim | 6 | ||||
-rw-r--r-- | vim/after/indent/yaml.vim | 2 | ||||
-rw-r--r-- | vim/after/plugin/2html.vim | 11 | ||||
-rw-r--r-- | vim/after/plugin/insert_cancel.vim | 4 | ||||
-rw-r--r-- | vim/after/plugin/matchparen.vim | 4 | ||||
-rw-r--r-- | vim/after/plugin/spellfile_local.vim | 13 | ||||
-rw-r--r-- | vim/after/plugin/undofileskip.vim | 7 | ||||
-rw-r--r-- | vim/after/syntax/bindzone.vim | 4 | ||||
-rw-r--r-- | vim/after/syntax/mail.vim | 3 | ||||
-rw-r--r-- | vim/after/syntax/resolv.vim | 6 | ||||
-rw-r--r-- | vim/after/syntax/sh.vim | 12 | ||||
-rw-r--r-- | vim/after/syntax/vim.vim | 2 |
17 files changed, 123 insertions, 26 deletions
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 4a1c3814..093dc5f5 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -4,13 +4,15 @@ setlocal formatoptions+=coqr let b:undo_ftplugin .= '|setlocal comments< formatoptions<' " Choose the color column depending on non-comment line count -augroup gitcommit_cursorcolumn - autocmd CursorMoved,CursorMovedI <buffer> - \ let &l:colorcolumn = gitcommit#CursorColumn() -augroup END -let b:undo_ftplugin .= '|execute ''autocmd! gitcommit_cursorcolumn''' - \ . '|augroup! gitcommit_cursorcolumn' - \ . '|setlocal colorcolumn<' +if exists('&colorcolumn') + augroup gitcommit_cursorcolumn + autocmd CursorMoved,CursorMovedI <buffer> + \ let &l:colorcolumn = gitcommit#CursorColumn() + augroup END + let b:undo_ftplugin .= '|execute ''autocmd! gitcommit_cursorcolumn''' + \ . '|augroup! gitcommit_cursorcolumn' + \ . '|setlocal colorcolumn<' +endif " Stop here if the user doesn't want ftplugin mappings if exists('no_plugin_maps') || exists('no_gitcommit_maps') diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 7e2ba439..21a84a42 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -4,7 +4,7 @@ if &filetype !=# 'html' finish endif -" Spellcheck documents we're actually editing (not just viewing) +" Check the spelling of documents we're actually editing (not just viewing) if &modifiable && !&readonly setlocal spell let b:undo_ftplugin .= '|setlocal spell<' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 738f17ec..4c07bac3 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,3 +1,13 @@ +" Restore global value for no_mail_maps that we set in +" ~/.vim/ftplugin/mail.vim to work around the bad maps set in +" $VIMRUNTIME/ftplugin/mail.vim +" +if exists('b:no_mail_maps') + let no_mail_maps = b:no_mail_maps +elseif exists('no_mail_maps') + unlet no_mail_maps +endif + " Don't append spaces after quote chars, for strict compliance with " format=flowed let b:quote_space = 0 @@ -8,7 +18,7 @@ command -bar -buffer SuggestStart let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart -" Normalise quoting +" Normalize quoting command -bar -buffer -range=% StrictQuote \ call mail#StrictQuote(<q-line1>, <q-line2>) let b:undo_ftplugin .= '|delcommand StrictQuote' @@ -66,9 +76,9 @@ let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>Q' \ . '|xunmap <buffer> <LocalLeader>Q' " Mappings for enforcing strict quoting -nnoremap <LocalLeader>s +nnoremap <buffer> <LocalLeader>s \ :StrictQuote<CR> -xnoremap <LocalLeader>s +xnoremap <buffer> <LocalLeader>s \ :StrictQuote<CR> let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>s' \ . '|xunmap <buffer> <LocalLeader>s' diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim new file mode 100644 index 00000000..2ca1ae89 --- /dev/null +++ b/vim/after/ftplugin/python.vim @@ -0,0 +1,35 @@ +" The Python runtime files didn't define b:undo_ftplugin until Vim v8.1.1048; +" if it's not set yet, set it here (to something innoccuous) so that the +" appending :let commands in the rest of this file don't break. +" +if !exists('b:undo_ftplugin') + let b:undo_ftplugin = 'setlocal tabstop<' +endif + +" Use pyflakes for syntax checking and autopep8 for tidying +compiler pyflakes +if executable('autopep8') + setlocal equalprg=autopep8\ -aaa\ --\ - + let b:undo_ftplugin .= '|setlocal equalprg<' +endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('no_plugin_maps') || exists('no_python_maps') + finish +endif + +" Mappings to choose compiler +nnoremap <buffer> <LocalLeader>c + \ :<C-U>compiler pyflakes<CR> +nnoremap <buffer> <LocalLeader>l + \ :<C-U>compiler pylint<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c' + \ . '|nunmap <buffer> <LocalLeader>l' + +" Mappings to choose 'equalprg' +nnoremap <buffer> <LocalLeader>t + \ :<C-U>setlocal equalprg=autopep8\ -aaa\ --\ -<CR> +nnoremap <buffer> <LocalLeader>i + \ :<C-U>setlocal equalprg<<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>t' + \ . '|nunmap <buffer> <LocalLeader>i' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 01f971b9..112523da 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -26,9 +26,9 @@ let &l:include = '\<source\>\|\<runtime!\=\>' " Search runtime paths for included scripts let &l:path = &runtimepath . ',' . &path -" Adjust the match words for the matchit plugin; the default filetype plugin -" matches e.g. an opening "function" with the first "return" within, which I -" don't like +" Adjust the match words for the matchit.vim plugin; the default filetype +" plugin matches e.g. an opening "function" with the first "return" within, +" which I don't like if exists('loaded_matchit') let b:match_words = '\<fu\%[nction]\>:\<endf\%[unction]\>,' \ . '\<\(wh\%[ile]\|for\)\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index da34eb75..4300e125 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,9 +1,9 @@ -" Use two (not four!) spaces for indentation, per convention -call indent#Spaces(2) - " Remove inapplicable defaults from 'indentkeys'; we should only need to undo " this if the stock plugin didn't already arrange that (before v7.3.539) setlocal indentkeys-=0#,0{,0},0),: if !exists('b:undo_indent') let b:undo_indent = 'setlocal indentkeys<' endif + +" Use two (not four!) spaces for indentation, per convention +call indent#Spaces(2) diff --git a/vim/after/indent/yaml.vim b/vim/after/indent/yaml.vim new file mode 100644 index 00000000..d0478631 --- /dev/null +++ b/vim/after/indent/yaml.vim @@ -0,0 +1,2 @@ +" Use two (not four!) spaces for indentation, per convention +call indent#Spaces(2) diff --git a/vim/after/plugin/2html.vim b/vim/after/plugin/2html.vim new file mode 100644 index 00000000..dd65486d --- /dev/null +++ b/vim/after/plugin/2html.vim @@ -0,0 +1,11 @@ +" Don't make these settings if the base plugin didn't load +if !exists('g:loaded_2html_plugin') + finish +endif + +" Set preferred fonts for the HTML rendering +let g:html_font = [ + \ 'DejaVu Sans Mono', + \ 'Ubuntu Mono', + \ 'Consolas', + \] diff --git a/vim/after/plugin/insert_cancel.vim b/vim/after/plugin/insert_cancel.vim new file mode 100644 index 00000000..a8abe6ed --- /dev/null +++ b/vim/after/plugin/insert_cancel.vim @@ -0,0 +1,4 @@ +" Set mapping for insert_cancel.vim +if exists('loaded_insert_cancel') + imap <C-C> <Plug>(InsertCancel) +endif diff --git a/vim/after/plugin/matchparen.vim b/vim/after/plugin/matchparen.vim new file mode 100644 index 00000000..b2be8f61 --- /dev/null +++ b/vim/after/plugin/matchparen.vim @@ -0,0 +1,4 @@ +" If matchparen.vim didn't load, use 'showmatch' instead +if !exists('loaded_matchparen') + set showmatch matchtime=3 +endif diff --git a/vim/after/plugin/spellfile_local.vim b/vim/after/plugin/spellfile_local.vim new file mode 100644 index 00000000..7d805660 --- /dev/null +++ b/vim/after/plugin/spellfile_local.vim @@ -0,0 +1,13 @@ +" Don't make these settings if the base plugin didn't load +if !exists('g:loaded_spellfile_local') + finish +endif + +" Use XDG dirs for 'spellfile' if XDG_DATA_HOME is useable +if xdg#DataHome() !=# '' + let g:spellfile_local_dirs = [ xdg#DataHome() ] + call extend( + \ g:spellfile_local_dirs, + \ xdg#DataDirs(), + \) +endif diff --git a/vim/after/plugin/undofileskip.vim b/vim/after/plugin/undofileskip.vim new file mode 100644 index 00000000..e7116940 --- /dev/null +++ b/vim/after/plugin/undofileskip.vim @@ -0,0 +1,7 @@ +" If undofileskip.vim loaded, add a few applicable paths to its list +if !exists('g:undofileskip') + finish +endif + +" Just split and copy 'backupskip' +let g:undofileskip = option#Split(&backupskip) diff --git a/vim/after/syntax/bindzone.vim b/vim/after/syntax/bindzone.vim index 29d5f4b8..f95aff8f 100644 --- a/vim/after/syntax/bindzone.vim +++ b/vim/after/syntax/bindzone.vim @@ -1,5 +1,5 @@ -" Highlight TLSA and SSHFP records correctly +" Highlight some newer/weirder records correctly " <https://github.com/vim/vim/issues/220> syn keyword zoneRRType - \ contained TLSA SSHFP + \ contained CAA SSHFP TLSA \ nextgroup=zoneRData skipwhite diff --git a/vim/after/syntax/mail.vim b/vim/after/syntax/mail.vim new file mode 100644 index 00000000..77c76f00 --- /dev/null +++ b/vim/after/syntax/mail.vim @@ -0,0 +1,3 @@ +" Don't spellcheck code in mail messages +syntax region mailCode start='`' end='`' keepend contains=@NoSpell +syntax region mailCodeBlock start=' \{4\}' end='$' contains=@NoSpell diff --git a/vim/after/syntax/resolv.vim b/vim/after/syntax/resolv.vim new file mode 100644 index 00000000..4c8ec165 --- /dev/null +++ b/vim/after/syntax/resolv.vim @@ -0,0 +1,6 @@ +" Over-simple but good-enough `nameserver` rule fix including IPv6 +" Version 1.4 of the syntax file has a more accurate fix +if !has('patch-8.2.0380') + syntax clear resolvIPNameserver + syntax match resolvIPNameserver contained /[0-9.a-fA-F:]\+/ +endif diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index af7670d5..d7cf040d 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -16,11 +16,11 @@ elseif exists('b:is_posix') endif " The syntax highlighter seems to flag '/baz' in '"${foo:-"$bar"/baz}"' as an -" error, which it isn't, at least in POSIX sh, Bash, and Ksh. +" error, which it isn't, at least in POSIX sh, Bash, and Korn shell. syntax clear shDerefWordError -" The syntax highlighter doesn't match parens for subshells for 'if' tests -" correctly if they're on separate lines. This happens enough that it's +" The syntax highlighter doesn't match parentheses for subshells for 'if' +" tests correctly if they're on separate lines. This happens enough that it's " probably not worth keeping the error. syntax clear shParenError @@ -33,7 +33,7 @@ syntax clear shTestError if exists('b:is_posix') " Highlight some commands that are both defined by POSIX and builtin - " commands in dash, as a rough but useable proxy for 'shell builtins'. This + " commands in dash, as a rough but usable proxy for 'shell builtins'. This " list was mostly wrested from `man 1 dash`. Also include control structure " keywords like `break`, `continue`, and `return`. syntax clear shStatement @@ -76,8 +76,8 @@ if exists('b:is_posix') " Core syntax/sh.vim puts IFS and other variables that affect shell function " in another color, but a subset of them actually apply to POSIX shell too - " (and plain Bourne). These are selected by searching the POSIX manpages. I - " added NLSPATH too, which wasn't in the original. + " (and plain Bourne). These are selected by searching the POSIX man pages. + " I added NLSPATH too, which wasn't in the original. syntax clear shShellVariables syntax cluster shCommandSubList add=shShellVariables syntax keyword shShellVariables diff --git a/vim/after/syntax/vim.vim b/vim/after/syntax/vim.vim index 438ce596..bd7d8274 100644 --- a/vim/after/syntax/vim.vim +++ b/vim/after/syntax/vim.vim @@ -4,7 +4,7 @@ syntax clear vimCommentString syntax clear vimCommentTitle " Highlight :CompilerSet commands like :set/:setlocal, but only in compiler -" scripts in recognisable paths +" scripts in recognizable paths if expand('%:p:h:t') ==# 'compiler' \ && expand('%:e') ==# 'vim' syntax keyword vimCommand contained |