diff options
Diffstat (limited to 'vim/after')
35 files changed, 238 insertions, 145 deletions
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index b5989410..d67e3654 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -1,14 +1,18 @@ -" Set 'commentstring' and 'include' back to their default C-friendly values -setlocal commentstring&vim -setlocal include&vim +" Set 'commentstring', 'define', and 'include' back to their default +" C-friendly values +setlocal commentstring&vim define&vim include&vim +let b:undo_ftplugin .= '|setlocal commentstring< define< include<' " Include macros in completion setlocal complete+=d +let b:undo_ftplugin .= '|setlocal complete<' + +" Fold based on indent level +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' " Include system headers on UNIX if has('unix') setlocal path+=/usr/include + let b:undo_ftplugin .= '|setlocal path<' endif - -" Undo all of the above -let b:undo_ftplugin .= '|setlocal commentstring< complete< include< path<' 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 93845a80..21a84a42 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -1,4 +1,10 @@ -" Spellcheck documents we're actually editing (not just viewing) +" None of this is appropriate for other filetypes that are just sourcing this +" filetype's scripts in, e.g. Markdown, PHP, so cut that off here +if &filetype !=# 'html' + finish +endif + +" Check the spelling of documents we're actually editing (not just viewing) if &modifiable && !&readonly setlocal spell let b:undo_ftplugin .= '|setlocal spell<' @@ -13,14 +19,14 @@ let b:undo_ftplugin .= '|unlet b:current_compiler' " it; we map \= to do the former, but don't actually set 'equalprg' for the " latter, instead falling back on the good-enough built-in Vim indentation " behavior -nnoremap <buffer> <Leader>= :<C-U>call html#TidyBuffer()<CR> +nnoremap <buffer> <Leader>= :<C-U>call html#Tidy()<CR> let b:undo_ftplugin .= '|nunmap <buffer> <Leader>=' " Set up hooks for timestamp updating augroup html_timestamp autocmd BufWritePre <buffer> \ if exists('b:html_timestamp_check') - \| call html#TimestampUpdate() + \| call html#timestamp#Update() \|endif augroup END let b:undo_ftplugin .= '|execute ''autocmd! html_timestamp''' @@ -33,10 +39,5 @@ endif " Transform URLs to HTML anchors nnoremap <buffer> <LocalLeader>r - \ :<C-U>call html#UrlLink()<CR> + \ :<C-U>call html#url#Anchor()<CR> let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>r' - -" Switch to PHP filetype for templated PHP -nnoremap <buffer> <LocalLeader>f - \ :<C-U>setlocal filetype=php<CR> -let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>f' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index f4a4c91d..4c07bac3 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,86 +1,31 @@ +" 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 let b:undo_ftplugin .= '|unlet b:quote_space' -" If something hasn't already moved the cursor, we'll move to an optimal point -" to start writing -function! s:SuggestStart() abort - - " Move to top of buffer - call setpos('.', [0, 1, 1, 0]) - - " Move to body text - call search('\m^$', 'c') | + - - " Start by trying to move to the first quoted line; this may fail if there's - " no quote, which is fine - call search('\m^>', 'c') - - " Delete quoted blank lines or quoted greetings until we get to something - " with substance. Yes, I like Perl, how could you tell? - while getline('.') =~? '^> *' - \ . '\%(' - \ . '\%(' - \ . 'g[''\u2019]\=day' - \ . '\|\%(good \)\=\%(morning\|afternoon\|evening\)' - \ . '\|h[eu]\%(ll\|rr\)o\+' - \ . '\|hey\+' - \ . '\|hi\+' - \ . '\|sup' - \ . '\|what[''\u2019]\=s up' - \ . '\|yo' - \ . '\)' - \ . '[[:punct:] ]*' - \ . '\%(' - \ . '\a\+' - \ . '[[:punct:] ]*' - \ . '\)\=' - \ . '\)\=$' - delete - endwhile - - " Now move to the first quoted or unquoted blank line - call search('\m^>\= *$', 'c') -endfunction -command! -bar -buffer SuggestStart - \ call s:SuggestStart() +command -bar -buffer SuggestStart + \ call mail#SuggestStart() let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart -" Normalise quoting -function! s:StrictQuote() abort - let body = 0 - for lnum in range(1, line('$')) - - " Get current line - let line = getline(lnum) - - " Skip lines until we hit a blank line, meaning body text - let body = body || !strlen(line) - if !body - continue - endif - - " Get the leading quote string, if any; skip if there isn't one - let quote = matchstr(line, '^>[> ]*') - if !strlen(quote) - continue - endif - - " Normalise the quote with no spaces - let quote = substitute(quote, '[^>]', '', 'g') - - " Re-set the line - let line = substitute(line, '^[> ]\+', quote, '') - call setline(lnum, line) - - endfor -endfunction -command -bar -buffer StrictQuote - \ call s:StrictQuote() +" Normalize quoting +command -bar -buffer -range=% StrictQuote + \ call mail#StrictQuote(<q-line1>, <q-line2>) let b:undo_ftplugin .= '|delcommand StrictQuote' -StrictQuote + +command -bar -buffer -nargs=1 SetImportance + \ call mail#importance#Set(<f-args>) +let b:undo_ftplugin .= '|delcommand SetImportance' " Add a space to the end of wrapped lines for format-flowed mail setlocal formatoptions+=w @@ -88,17 +33,8 @@ let b:undo_ftplugin .= '|setlocal formatoptions<' " Mail-specific handling for custom vim-squeeze-repeat-blanks plugin if exists('loaded_squeeze_repeat_blanks') - - " Set the blank line pattern let b:squeeze_repeat_blanks_blank = '^[ >]*$' let b:undo_ftplugin .= '|unlet b:squeeze_repeat_blanks_blank' - - " If there is anything quoted in this message (i.e. it looks like a reply), - " squeeze blanks, but don't report lines deleted - if search('\m^>', 'cnw') - silent SqueezeRepeatBlanks - endif - endif " Spellcheck documents we're actually editing (not just viewing) @@ -113,12 +49,15 @@ if exists('no_plugin_maps') || exists('no_mail_maps') endif " Flag messages as important/unimportant -nnoremap <buffer> <LocalLeader>h - \ :<C-U>call mail#FlagImportant()<CR> -let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>h' -nnoremap <buffer> <LocalLeader>l - \ :<C-U>call mail#FlagUnimportant()<CR> -let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>l' +nnoremap <buffer> <LocalLeader>ih + \ :<C-U>SetImportance high<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>ih' +nnoremap <buffer> <LocalLeader>il + \ :<C-U>SetImportance low<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>il' +nnoremap <buffer> <LocalLeader>in + \ :<C-U>SetImportance normal<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>in' " Quote operator nnoremap <buffer> <expr> <LocalLeader>q @@ -136,6 +75,14 @@ xnoremap <buffer> <expr> <LocalLeader>Q let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>Q' \ . '|xunmap <buffer> <LocalLeader>Q' +" Mappings for enforcing strict quoting +nnoremap <buffer> <LocalLeader>s + \ :StrictQuote<CR> +xnoremap <buffer> <LocalLeader>s + \ :StrictQuote<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>s' + \ . '|xunmap <buffer> <LocalLeader>s' + " Maps using autoloaded function for quoted paragraph movement nnoremap <buffer> <silent> <LocalLeader>[ \ :<C-U>call mail#NewBlank(v:count1, 1, 0)<CR> diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index a303fa75..9333e234 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -1,8 +1,15 @@ " Use Perl itself for checking and Perl::Tidy for tidying compiler perl -setlocal equalprg=perltidy let b:undo_ftplugin .= '|unlet b:current_compiler' - \ . '|setlocal equalprg< errorformat< makeprg<' + \ . '|setlocal errorformat< makeprg<' +if executable('perltidy') + setlocal equalprg=perltidy + let b:undo_ftplugin .= '|setlocal equalprg<' +endif + +" Fold based on indent level +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' " Add angle brackets to pairs of matched characters for q<...> setlocal matchpairs+=<:> @@ -33,6 +40,14 @@ nnoremap <buffer> <LocalLeader>l let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c' \ . '|nunmap <buffer> <LocalLeader>l' +" Mappings to choose 'equalprg' +nnoremap <buffer> <LocalLeader>t + \ :<C-U>setlocal equalprg=perltidy<CR> +nnoremap <buffer> <LocalLeader>i + \ :<C-U>setlocal equalprg<<CR> +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>t' + \ . '|nunmap <buffer> <LocalLeader>i' + " Bump version numbers nmap <buffer> <LocalLeader>v \ <Plug>(PerlVersionBumpMinor) diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 58d83c49..b747a14e 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -2,12 +2,20 @@ compiler php let b:undo_ftplugin .= '|unlet b:current_compiler' \ . '|setlocal errorformat< makeprg<' +if executable('php-cs-fixer') + setlocal equalprg=phpcsff + let b:undo_ftplugin .= '|setlocal equalprg<' +endif " Set comment formats setlocal comments=s1:/*,m:*,ex:*/,://,:# setlocal formatoptions+=or let b:undo_ftplugin .= '|setlocal comments< formatoptions<' +" Fold based on indent level +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' + " Use pman as 'keywordprg' setlocal keywordprg=pman let b:undo_ftplugin .= '|setlocal keywordprg<' @@ -16,12 +24,20 @@ let b:undo_ftplugin .= '|setlocal keywordprg<' let b:regex_escape_flavor = 'ere' let b:undo_ftplugin .= '|unlet b:regex_escape_flavor' +" Set HTML as an alternative filetype +if !exists('b:alternate_filetypes') + let b:alternate_filetypes = [&filetype, 'html'] +endif + " Stop here if the user doesn't want ftplugin mappings if exists('no_plugin_maps') || exists('no_php_maps') finish endif -" Switch to HTML filetype for templated PHP +" Mappings to choose 'equalprg' nnoremap <buffer> <LocalLeader>f - \ :<C-U>setlocal filetype=html<CR> + \ :<C-U>setlocal equalprg=phpcsff<CR> +nnoremap <buffer> <LocalLeader>i + \ :<C-U>setlocal equalprg<<CR> let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>f' + \ . '|nunmap <buffer> <LocalLeader>i' 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/sh.vim b/vim/after/ftplugin/sh.vim index 8468b133..2c68d83a 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -3,6 +3,10 @@ setlocal comments=:# setlocal formatoptions+=or let b:undo_ftplugin .= '|setlocal comments< formatoptions<' +" Fold based on indent level +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' + " If subtype is Bash, set 'keywordprg' to han(1df) if exists('b:is_bash') setlocal keywordprg=han diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 30182bba..112523da 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -9,6 +9,10 @@ endif let b:regex_escape_flavor = 'vim' let b:undo_ftplugin .= '|unlet b:regex_escape_flavor' +" Fold based on indent level +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' + " Use :help as 'keywordprg' if not already set; this is the default since Vim " v8.1.1290 if &keywordprg !=# ':help' @@ -22,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/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim index 5aa2600a..c361c859 100644 --- a/vim/after/ftplugin/zsh.vim +++ b/vim/after/ftplugin/zsh.vim @@ -2,3 +2,7 @@ compiler zsh let b:undo_ftplugin .= '|unlet b:current_compiler' \ . '|setlocal errorformat< makeprg<' + +" Fold based on indent level, but start with all folds open +setlocal foldmethod=indent +let b:undo_ftplugin .= '|setlocal foldmethod<' diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/awk.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim new file mode 100644 index 00000000..45db2ebc --- /dev/null +++ b/vim/after/indent/c.vim @@ -0,0 +1,4 @@ +" If the path to the file looks like the Vim sources, set 'shiftwidth' to 4 +if expand('%:p') =~# '/vim.*src/' + setlocal shiftwidth=4 +endif diff --git a/vim/after/indent/css.vim b/vim/after/indent/css.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/css.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim deleted file mode 100644 index 16a948ab..00000000 --- a/vim/after/indent/gitconfig.vim +++ /dev/null @@ -1,6 +0,0 @@ -" Use tabs for indent in Git config files, rather than fighting with the -" frontend tool -setlocal noexpandtab -setlocal softtabstop=0 -let &shiftwidth = &tabstop -let b:undo_indent .= '|setlocal expandtab< softtabstop< shiftwidth<' diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim index a7a085fe..4cb4a678 100644 --- a/vim/after/indent/html.vim +++ b/vim/after/indent/html.vim @@ -1,3 +1,6 @@ +" Use four spaces for indentation +call indent#Spaces(4) + " Clear away the flag we set to indent after paragraphs unlet html_indent_inctags diff --git a/vim/after/indent/javascript.vim b/vim/after/indent/javascript.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/javascript.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/mail.vim b/vim/after/indent/mail.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/mail.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/make.vim b/vim/after/indent/make.vim deleted file mode 100644 index 341cd7f6..00000000 --- a/vim/after/indent/make.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Use 'tabstop' (8 columns, a full tab) for indent operations in Makefiles. -" It seems odd that the stock plugin doesn't force this on its own. -setlocal shiftwidth=0 -let b:undo_indent = 'setlocal shiftwidth<' diff --git a/vim/after/indent/markdown.vim b/vim/after/indent/markdown.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/markdown.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/perl.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/php.vim b/vim/after/indent/php.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/php.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/sh.vim b/vim/after/indent/sh.vim new file mode 100644 index 00000000..bff1b904 --- /dev/null +++ b/vim/after/indent/sh.vim @@ -0,0 +1,2 @@ +" Use four spaces for indentation +call indent#Spaces(4) diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 0767bca0..4300e125 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -5,10 +5,5 @@ if !exists('b:undo_indent') let b:undo_indent = 'setlocal indentkeys<' endif -" Observe VimL conventions for two-space indents -setlocal shiftwidth=2 -let b:undo_indent .= '|setlocal shiftwidth<' -if &softtabstop != -1 - let &l:softtabstop = &l:shiftwidth - let b:undo_indent .= '|setlocal softtabstop<' -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/dist.vim b/vim/after/plugin/dist.vim index 98574de8..c53ebd2c 100644 --- a/vim/after/plugin/dist.vim +++ b/vim/after/plugin/dist.vim @@ -7,3 +7,4 @@ unlet loaded_rrhelper unlet loaded_spellfile_plugin unlet loaded_tarPlugin unlet loaded_zipPlugin +unlet loaded_manpager_plugin 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 e67803cc..bd7d8274 100644 --- a/vim/after/syntax/vim.vim +++ b/vim/after/syntax/vim.vim @@ -1,8 +1,10 @@ -" Remove special highlighting for double-quoted strings in comments +" Remove special highlighting for double-quoted strings and colon labels in +" comments 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 |