From eb97e0710ca1dee99cba8f5c44d80b84b0310a62 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:52:37 +1300 Subject: Wrap Vim gitcommit autocmd clear in :execute Noticed that my b:undo_ftplugin script for this filetype was only getting halfway through its work, and stopping at this command. From `:help autocmd`: > Note: The ":autocmd" command can only be followed by another command when the > '|' appears before {cmd}. This works: > :augroup mine | au! BufRead | augroup END > But this sees "augroup" as part of the defined command: > :augroup mine | au! BufRead * | augroup END > :augroup mine | au BufRead * set tw=70 | augroup END > Instead you can put the group name into the command: > :au! mine BufRead * > :au mine BufRead * set tw=70 > Or use :execute: > :augroup mine | exe "au! BufRead *" | augroup END > :augroup mine | exe "au BufRead * set tw=70" | augroup END --- vim/after/ftplugin/gitcommit.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 2dc5fa37..0ba80c92 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -14,7 +14,7 @@ if has('autocmd') && exists('+cursorcolumn') autocmd CursorMoved,CursorMovedI \ let &l:colorcolumn = gitcommit#CursorColumn() augroup END - let b:undo_ftplugin .= '|autocmd! gitcommit' + let b:undo_ftplugin .= '|execute ''autocmd! gitcommit''' \ . '|augroup! gitcommit' endif -- cgit v1.2.3 From 59a0e5e3201c6041d3ca3da8efcb6e2b2b81fedd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:54:49 +1300 Subject: Restore value of 'colorcolumn' after ft=gitcommit --- vim/after/ftplugin/gitcommit.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'vim/after') diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 0ba80c92..18bacfb8 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -16,6 +16,7 @@ if has('autocmd') && exists('+cursorcolumn') augroup END let b:undo_ftplugin .= '|execute ''autocmd! gitcommit''' \ . '|augroup! gitcommit' + \ . '|setlocal colorcolumn<' endif " Stop here if the user doesn't want ftplugin mappings -- cgit v1.2.3 From 653b5bee4391d74be53b10b31ab39ba16411e63f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:57:10 +1300 Subject: Abbreviate Vim ft=html autocmd clearing --- vim/after/ftplugin/html.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 759d06bf..821ba280 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -16,7 +16,7 @@ augroup html_timestamp \| call html#TimestampUpdate() \|endif augroup END -let b:undo_ftplugin .= '|autocmd! html_timestamp BufWritePre ' +let b:undo_ftplugin .= '|autocmd! html_timestamp' " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_html_maps') -- cgit v1.2.3 From 46f7b5b6413c28b8d1ddbe9b9abe59d88a7ee153 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:58:05 +1300 Subject: Add timestamp augroup clearing to Vim ft=html --- vim/after/ftplugin/html.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'vim/after') diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 821ba280..46282f7f 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -17,6 +17,7 @@ augroup html_timestamp \|endif augroup END let b:undo_ftplugin .= '|autocmd! html_timestamp' + \ . '|augroup! htmltimestamp' " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_html_maps') -- cgit v1.2.3 From c921c0d016c9d52c74083baecde1e0fe0e2e61eb Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:58:32 +1300 Subject: Wrap autocmd! clear for ft=mail in :execute See commit 0748687. --- vim/after/ftplugin/html.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 46282f7f..29128c03 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -16,8 +16,8 @@ augroup html_timestamp \| call html#TimestampUpdate() \|endif augroup END -let b:undo_ftplugin .= '|autocmd! html_timestamp' - \ . '|augroup! htmltimestamp' +let b:undo_ftplugin .= '|execute ''autocmd! html_timestamp''' + \ . '|augroup! html_timestamp' " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_html_maps') -- cgit v1.2.3 From add78dd0267a26936a964ea08eb0e1515457b90a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 20:07:09 +1300 Subject: Clear away stock ft=mail quoting maps --- vim/after/ftplugin/mail.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vim/after') diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 688ca6eb..d93b230e 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -41,6 +41,13 @@ if exists('g:no_plugin_maps') || exists('g:no_mail_maps') finish endif +" Clear away the quoting maps that the stock mail.vim sets; they work fine, +" but we have nicer ones to define shortly +nunmap q +vunmap q +nunmap MailQuote +vunmap MailQuote + " Flag messages as important/unimportant nnoremap h \ :call mail#FlagImportant() -- cgit v1.2.3 From bc823fab3c7fdbb742fa0e2fb0e4cb19de1cf079 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 21:13:16 +1300 Subject: Simplify ft=sh subtype flag clearing These flags are also set and examined by the stock syntax for the "sh" filetype, so checking for whether they're set at runtime for the ftplugin just confuses things. Just clear them unconditionally instead. --- vim/after/ftplugin/sh.vim | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index fdc42ccc..431e5037 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -34,14 +34,9 @@ if exists('b:is_posix') endif " Queue up undo commands to clear the shell language flags that we set for -" this buffer during filetype detection in filetype.vim -if exists('b:is_bash') - let b:undo_ftplugin .= '|unlet b:is_bash' -elseif exists('b:is_kornshell') - let b:undo_ftplugin .= '|unlet b:is_kornshell' -elseif exists('b:is_posix') - let b:undo_ftplugin .= '|unlet b:is_posix' -endif +" this buffer during filetype detection in filetype.vim, or that the stock +" syntax highlighting chose for us +let b:undo_ftplugin .= '|unlet! b:is_bash b:is_kornshell b:is_posix' " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_sh_maps') -- cgit v1.2.3 From 61ad1432240290f889ef11a4b527163cc8fff83d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:23:06 +1300 Subject: Simplify after/ftplugin for C Allow the cpp plugin to load this, since it's the same anyway, and push all the undo stuff together. --- vim/after/ftplugin/c.vim | 11 +++-------- vim/after/ftplugin/cpp.vim | 18 ------------------ 2 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 vim/after/ftplugin/cpp.vim (limited to 'vim/after') diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index da34d269..ccc5b170 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -1,18 +1,13 @@ -" Extra configuration for C files -if &filetype !=# 'c' || v:version < 700 - finish -endif - " Include macros in completion setlocal complete+=d -let b:undo_ftplugin .= '|setlocal complete<' " Set include pattern setlocal include=^\\s*#\\s*include -let b:undo_ftplugin .= '|setlocal include<' " Include 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 complete< include< path<' diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim deleted file mode 100644 index 4042fb84..00000000 --- a/vim/after/ftplugin/cpp.vim +++ /dev/null @@ -1,18 +0,0 @@ -" Extra configuration for C++ files -if &filetype !=# 'cpp' || v:version < 700 - finish -endif - -" Include macros in completion -setlocal complete+=d -let b:undo_ftplugin .= '|setlocal complete<' - -" Set include pattern -setlocal include=^\\s*#\\s*include -let b:undo_ftplugin .= '|setlocal include<' - -" Include headers on UNIX -if has('unix') - setlocal path+=/usr/include - let b:undo_ftplugin .= '|setlocal path<' -endif -- cgit v1.2.3 From dc59d7e74635f9a56fef9049e34411d6ef535650 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:26:52 +1300 Subject: Remove boilerplate after/ftplugin load guards I'm likely going to move away from Vim 6.0 support, at least for all of this filetype stuff. We will keep the one filetype load guard we actually need, which is the HTML one, to stop plugins like markdown.vim from loading it. --- vim/after/ftplugin/diff.vim | 5 ----- vim/after/ftplugin/gitcommit.vim | 5 ----- vim/after/ftplugin/help.vim | 5 ----- vim/after/ftplugin/html.vim | 4 ++-- vim/after/ftplugin/mail.vim | 5 ----- vim/after/ftplugin/make.vim | 5 ----- vim/after/ftplugin/markdown.vim | 5 ----- vim/after/ftplugin/perl.vim | 5 ----- vim/after/ftplugin/php.vim | 5 ----- vim/after/ftplugin/sh.vim | 5 ----- vim/after/ftplugin/text.vim | 5 ----- vim/after/ftplugin/vim.vim | 5 ----- vim/after/ftplugin/zsh.vim | 5 ----- 13 files changed, 2 insertions(+), 62 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim index a52b3fdd..15682e7b 100644 --- a/vim/after/ftplugin/diff.vim +++ b/vim/after/ftplugin/diff.vim @@ -1,8 +1,3 @@ -" Extra configuration for diffs -if &filetype !=# 'diff' || v:version < 700 || &compatible - finish -endif - " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_diff_maps') finish diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 18bacfb8..762df0ba 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -1,8 +1,3 @@ -" Extra configuration for Git commit messages -if &filetype !=# 'gitcommit' || v:version < 700 - finish -endif - " Make angle brackets behave like mail quotes setlocal comments+=n:> setlocal formatoptions+=coqr diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim index 71ad3a8d..ae032344 100644 --- a/vim/after/ftplugin/help.vim +++ b/vim/after/ftplugin/help.vim @@ -1,8 +1,3 @@ -" Extra configuration for Vim help files -if &filetype !=# 'help' || v:version < 700 - finish -endif - " This variable had the wrong name before Vim 7.1 if v:version == 700 && exists('b:undo_plugin') let b:undo_ftplugin = b:undo_plugin diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 29128c03..b5c387fb 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -1,5 +1,5 @@ -" Extra configuration for HTML files -if &filetype !=# 'html' || v:version < 700 || &compatible +" Don't load if the buffer is not actually HTML (e.g. Markdown) +if &filetype !=# 'html' finish endif diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index d93b230e..e8b64164 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,8 +1,3 @@ -" Extra configuration for mail messages -if &filetype !=# 'mail' || &compatible || v:version < 700 - finish -endif - " If something hasn't already moved the cursor, we'll move to an optimal point " to start writing if line('.') == 1 && col('.') == 1 diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim index 3018e11b..353a0bbf 100644 --- a/vim/after/ftplugin/make.vim +++ b/vim/after/ftplugin/make.vim @@ -1,8 +1,3 @@ -" Extra configuration for Makefiles -if &filetype !=# 'make' || v:version < 700 - finish -endif - " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_make_maps') finish diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index cd8873b9..1a5a055b 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -1,8 +1,3 @@ -" Extra configuration for Markdown documents -if &filetype !=# 'markdown' || v:version < 700 - finish -endif - " Spellchecking features if has('spell') diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index ee8da2a7..5dd2b7bb 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -1,8 +1,3 @@ -" Extra configuration for Perl filetypes -if &filetype !=# 'perl' || v:version < 700 || &compatible - finish -endif - " Use Perl itself for checking and Perl::Tidy for tidying compiler perl setlocal equalprg=perltidy diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 9b7c2bb0..172256db 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -1,8 +1,3 @@ -" Extra configuration for PHP scripts -if &filetype !=# 'php' || v:version < 700 || &compatible - finish -endif - " Use PHP itself for syntax checking compiler php let b:undo_ftplugin .= '|unlet b:current_compiler' diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 431e5037..6ee016a5 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -1,8 +1,3 @@ -" Extra configuration for shell script -if &filetype !=# 'sh' || v:version < 700 || &compatible - finish -endif - " Set comment formats setlocal comments=:# setlocal formatoptions+=or diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim index 8341f72d..cda2891c 100644 --- a/vim/after/ftplugin/text.vim +++ b/vim/after/ftplugin/text.vim @@ -1,8 +1,3 @@ -" Extra configuration for text files -if &filetype !=# 'text' || v:version < 700 - finish -endif - " Spellcheck documents we're actually editing (not just viewing) if has('spell') && &modifiable && !&readonly setlocal spell diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 2fc5bd78..9f6245a5 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -1,8 +1,3 @@ -" Extra configuration for Vim scripts -if &filetype !=# 'vim' || v:version < 700 || &compatible - finish -endif - " Use Vint as a syntax checker if bufname('%') !=# 'command-line' compiler vint diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim index 49736401..5aa2600a 100644 --- a/vim/after/ftplugin/zsh.vim +++ b/vim/after/ftplugin/zsh.vim @@ -1,8 +1,3 @@ -" Extra configuration for Z shell scripts -if &filetype !=# 'zsh' || v:version < 700 || &compatible - finish -endif - " Use Z shell itself as a syntax checker compiler zsh let b:undo_ftplugin .= '|unlet b:current_compiler' -- cgit v1.2.3 From 5f1f5b9de3d9ab80a0b5ecef4559b88990f42f4a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:29:09 +1300 Subject: Remove double-key mapping shortcuts I never use these anyway; I'm firmly in the habit of using underscores to represent the current line these days. --- vim/after/ftplugin/diff.vim | 2 -- vim/after/ftplugin/gitcommit.vim | 4 ---- vim/after/ftplugin/mail.vim | 4 ---- vim/after/ftplugin/markdown.vim | 4 ---- 4 files changed, 14 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim index 15682e7b..1813e4b0 100644 --- a/vim/after/ftplugin/diff.vim +++ b/vim/after/ftplugin/diff.vim @@ -28,8 +28,6 @@ nmap p \ (DiffPrune) xmap p \ (DiffPrune) -nmap pp - \ (DiffPrune)_ let b:undo_ftplugin .= '|nunmap p' \ . '|xunmap p' \ . '|nunmap pp' diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 762df0ba..1a4c1b1b 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -22,8 +22,6 @@ endif " Quote operator nnoremap q \ quote#Quote() -nnoremap qq - \ quote#Quote().'_' xnoremap q \ quote#Quote() let b:undo_ftplugin .= '|nunmap q' @@ -33,8 +31,6 @@ let b:undo_ftplugin .= '|nunmap q' " Quote operator with reformatting nnoremap Q \ quote#QuoteReformat() -nnoremap QQ - \ quote#QuoteReformat().'_' xnoremap Q \ quote#QuoteReformat() let b:undo_ftplugin .= '|nunmap Q' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index e8b64164..74ec1699 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -54,8 +54,6 @@ let b:undo_ftplugin .= '|nunmap l' " Quote operator nnoremap q \ quote#Quote() -nnoremap qq - \ quote#Quote().'_' xnoremap q \ quote#Quote() let b:undo_ftplugin .= '|nunmap q' @@ -65,8 +63,6 @@ let b:undo_ftplugin .= '|nunmap q' " Quote operator with reformatting nnoremap Q \ quote#QuoteReformat() -nnoremap QQ - \ quote#QuoteReformat().'_' xnoremap Q \ quote#QuoteReformat() let b:undo_ftplugin .= '|nunmap Q' diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index 1a5a055b..f129deba 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -24,8 +24,6 @@ endif " Quote operator nnoremap q \ quote#Quote() -nnoremap qq - \ quote#Quote().'_' xnoremap q \ quote#Quote() let b:undo_ftplugin .= '|nunmap q' @@ -35,8 +33,6 @@ let b:undo_ftplugin .= '|nunmap q' " Quote operator with reformatting nnoremap Q \ quote#QuoteReformat() -nnoremap QQ - \ quote#QuoteReformat().'_' xnoremap Q \ quote#QuoteReformat() let b:undo_ftplugin .= '|nunmap Q' -- cgit v1.2.3 From 04cf824ac17f25ce36f04b5ab6c5e8befbe25e90 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:30:11 +1300 Subject: Add missing detail to a comment --- vim/after/ftplugin/diff.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim index 1813e4b0..123f0d0a 100644 --- a/vim/after/ftplugin/diff.vim +++ b/vim/after/ftplugin/diff.vim @@ -23,7 +23,7 @@ let b:undo_ftplugin .= '|nunmap [' \ . '|xunmap [' \ . '|xunmap ]' -" Set mappings +" Set mappings for diff pruning plugin nmap p \ (DiffPrune) xmap p -- cgit v1.2.3 From 381b85d5067f496d65faa9fab54752299f61ad98 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:36:46 +1300 Subject: Remove some overzealous b:undo_* setting It's not that these shouldn't be set, it's more that it's the wrong place to do it, especially before they've caused any actual problems. --- vim/after/ftplugin/php.vim | 6 ------ vim/after/ftplugin/vim.vim | 17 ----------------- 2 files changed, 23 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 172256db..688166ba 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -16,9 +16,3 @@ let b:undo_ftplugin .= '|setlocal keywordprg<' if exists('g:no_plugin_maps') || exists('g:no_php_maps') finish endif - -" Get rid of the core ftplugin's square-bracket maps on unload -let b:undo_ftplugin .= '|nunmap [[' - \ . '|ounmap [[' - \ . '|nunmap ]]' - \ . '|ounmap ]]' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 9f6245a5..a7a69993 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -14,20 +14,3 @@ endif nnoremap K \ :helpgrep let b:undo_ftplugin .= '|nunmap K' - -" Get rid of the core ftplugin's square-bracket maps on unload -" 8.1.273 updated the runtime files to include a fix for this -if v:version < 801 || v:version == 801 && !has('patch273') - let b:undo_ftplugin .= '|nunmap [[' - \ . '|vunmap [[' - \ . '|nunmap ]]' - \ . '|vunmap ]]' - \ . '|nunmap []' - \ . '|vunmap []' - \ . '|nunmap ][' - \ . '|vunmap ][' - \ . '|nunmap ]"' - \ . '|vunmap ]"' - \ . '|nunmap ["' - \ . '|vunmap ["' -endif -- cgit v1.2.3 From b202810bb1fa50905a5d7840d5fd4b00e34dbd8f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:41:00 +1300 Subject: Pare down after/indent scripts a fair bit More overzealous undo-setting. I should wait until it becomes an actual issue. --- vim/after/indent/awk.vim | 7 ------- vim/after/indent/html.vim | 3 +-- vim/after/indent/perl.vim | 9 --------- vim/after/indent/vim.vim | 20 ++++---------------- 4 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 vim/after/indent/awk.vim delete mode 100644 vim/after/indent/perl.vim (limited to 'vim/after') diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim deleted file mode 100644 index fc848d2a..00000000 --- a/vim/after/indent/awk.vim +++ /dev/null @@ -1,7 +0,0 @@ -" The stock AWK indenting is decent, but doesn't include an undo variable; -" this adds one, clearing away the sole global function too. -if !exists('b:undo_indent') - let b:undo_indent = 'unlet! b:did_indent' - let b:undo_indent = b:undo_indent . '|setlocal indentexpr< indentkeys<' - let b:undo_indent = b:undo_indent . '|delfunction! GetAwkIndent' -endif diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim index 6eae00ac..df74b174 100644 --- a/vim/after/indent/html.vim +++ b/vim/after/indent/html.vim @@ -1,4 +1,3 @@ " Don't re-indent lines on right-angle-bracket or enter -setlocal indentkeys-=<>> -setlocal indentkeys-= +setlocal indentkeys-=<>>, let b:undo_ftplugin .= '|setlocal indentkeys<' diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim deleted file mode 100644 index 6f97d979..00000000 --- a/vim/after/indent/perl.vim +++ /dev/null @@ -1,9 +0,0 @@ -" The stock Perl indenting is decent, but doesn't include an undo variable; -" this adds one -if !exists('b:undo_indent') - let b:undo_indent = 'unlet! b:did_indent' - let b:undo_indent = b:undo_indent . '|setlocal indentexpr< indentkeys<' - let b:undo_indent = b:undo_indent . '|unlet! b:indent_use_syntax' - let b:undo_indent = b:undo_indent . '|unlet! b:match_skip' - let b:undo_indent = b:undo_indent . '|unlet! b:match_words' -endif diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 7e36c4cc..548d3e5c 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,20 +1,8 @@ " Observe VimL conventions for two-space indents setlocal shiftwidth=2 -if v:version > 703 || v:version == 703 && has('patch693') - setlocal softtabstop=-1 -else - setlocal softtabstop=2 -endif +setlocal softtabstop=2 +let b:undo_indent .= '|setlocal shiftwidth< softtabstop<' " Remove inapplicable defaults from 'indentkeys' -setlocal indentkeys-=0# -setlocal indentkeys-=0{ -setlocal indentkeys-=0} -setlocal indentkeys-=0) -setlocal indentkeys-=: - -" Commands to undo the above -if exists('b:undo_indent') - let b:undo_indent = b:undo_indent . '|setlocal shiftwidth<' - let b:undo_indent = b:undo_indent . '|setlocal softtabstop<' -endif +setlocal indentkeys-=0#,0{,0},0),: +let b:undo_indent .= '|setlocal indentkeys<' -- cgit v1.2.3 From 94a37ae9558292868ad00094ca1dfc278d8e9adb Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:43:46 +1300 Subject: Remove some Vim syntax boilerplate --- vim/after/syntax/bindzone.vim | 6 ------ vim/after/syntax/gitcommit.vim | 6 ------ vim/after/syntax/messages.vim | 6 ------ 3 files changed, 18 deletions(-) (limited to 'vim/after') diff --git a/vim/after/syntax/bindzone.vim b/vim/after/syntax/bindzone.vim index cc50638c..19989995 100644 --- a/vim/after/syntax/bindzone.vim +++ b/vim/after/syntax/bindzone.vim @@ -1,9 +1,3 @@ -" Don't try to make these corrections if running 'compatible' or if the -" runtime files are too old -if &compatible || v:version < 700 - finish -endif - " Highlight TLSA and SSHFP records correctly " syn keyword zoneRRType contained TLSA SSHFP nextgroup=zoneRData skipwhite diff --git a/vim/after/syntax/gitcommit.vim b/vim/after/syntax/gitcommit.vim index 2232e499..e47091f9 100644 --- a/vim/after/syntax/gitcommit.vim +++ b/vim/after/syntax/gitcommit.vim @@ -1,8 +1,2 @@ -" Don't try to make these corrections if running 'compatible' or if the -" runtime files are too old -if &compatible || v:version < 700 - finish -endif - " If my commit subject is too long, highlight it as an error. highlight link gitCommitOverflow Error diff --git a/vim/after/syntax/messages.vim b/vim/after/syntax/messages.vim index 75fe89b9..04faa607 100644 --- a/vim/after/syntax/messages.vim +++ b/vim/after/syntax/messages.vim @@ -1,9 +1,3 @@ -" Don't try to make these corrections if running 'compatible' or if the -" runtime files are too old -if &compatible || v:version < 700 - finish -endif - " The highlighting for errors in syslog/messages files is more often annoying " than useful, so just turn it off. syntax clear messagesError -- cgit v1.2.3 From 2f56e69e935e48c248b507cca9869d4ee53e6a97 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:50:21 +1300 Subject: Clear away a flag after HTML indent load --- vim/after/indent/html.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'vim/after') diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim index df74b174..0309881c 100644 --- a/vim/after/indent/html.vim +++ b/vim/after/indent/html.vim @@ -1,3 +1,6 @@ +" Clear away the flag we set to indent after paragraphs +unlet g:html_indent_inctags + " Don't re-indent lines on right-angle-bracket or enter setlocal indentkeys-=<>>, let b:undo_ftplugin .= '|setlocal indentkeys<' -- cgit v1.2.3 From f0bcb51101807840770788229a2da7905370912f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:52:03 +1300 Subject: Simplify a load guard for sh.vim syntax tweaks --- vim/after/syntax/sh.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'vim/after') diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index f02f30f5..872d659c 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -1,6 +1,5 @@ -" Don't try to make these corrections if running 'compatible' or if the -" runtime files are too old -if &compatible || v:version < 700 +" Don't try to make these corrections if the runtime files are too old +if v:version < 700 finish endif -- cgit v1.2.3 From 7fed281d49ee41a15a1c2c6e9d565e264a0abf1d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 23:57:13 +1300 Subject: Require Vim 7 for filetype and syntax highlights It's time! The rest of the vimrc can probably be allowed to load, though. --- vim/after/syntax/sh.vim | 5 ----- 1 file changed, 5 deletions(-) (limited to 'vim/after') diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index 872d659c..bdedaf65 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -1,8 +1,3 @@ -" Don't try to make these corrections if the runtime files are too old -if v:version < 700 - finish -endif - " Remove g:is_posix if we resorted to it in order to get correct POSIX sh " highlighting with older Vim runtime files if exists('g:is_posix') -- cgit v1.2.3