From 2bcf57aab5f98c5006da5a638c968f08f4fc63ce Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 25 Nov 2018 02:10:48 +1300 Subject: Undo shell script dialect flags from filetype.vim These local buffer variable flags weren't being cleared correctly on a filetype change. --- vim/after/ftplugin/sh.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'vim') diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 766994b7..fdc42ccc 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -33,6 +33,16 @@ if exists('b:is_posix') let g:is_posix = 1 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 + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_sh_maps') finish -- cgit v1.2.3 From 9bb807878c64ffde8da20aab0d817423f3531435 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 25 Nov 2018 02:24:24 +1300 Subject: Set missing b:undo_indent instructions for AWK Switching filetypes from "awk" to another type doesn't load the indentation of the new type, due to the absence of this setting. --- vim/after/indent/awk.vim | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 vim/after/indent/awk.vim (limited to 'vim') diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim new file mode 100644 index 00000000..fc848d2a --- /dev/null +++ b/vim/after/indent/awk.vim @@ -0,0 +1,7 @@ +" 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 -- cgit v1.2.3 From 9c99918394b395c81edfd29f068e6ce830631977 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 25 Nov 2018 02:30:12 +1300 Subject: Define b:undo_indent for Perl buffers This should probably be pushed upstream. --- vim/after/indent/perl.vim | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 vim/after/indent/perl.vim (limited to 'vim') diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim new file mode 100644 index 00000000..6f97d979 --- /dev/null +++ b/vim/after/indent/perl.vim @@ -0,0 +1,9 @@ +" 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 -- cgit v1.2.3 From 5af0bddaaa20478ddbf318424ce7906a4c1565e3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 25 Nov 2018 12:25:27 +1300 Subject: Remove vim-tiny workaround for 'undodir' setting Commit 575f00d changed the setting for 'undodir' and similar path-based settings to set the values conditionally based on the operating system being used, while still setting them sensibly for "tiny" builds of Vim on Unix, which skips all :if blocks. This isn't necessary for 'undodir', because a tiny build of Vim won't have the persistent_undo feature required for the option to exist at all, so we can make this particular setting a little less awkward. The 'backupdir' and 'directory' settings, however, need to keep their existing structure to remain interoperable. --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vim') diff --git a/vim/vimrc b/vim/vimrc index 03844def..25fe4e05 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -198,10 +198,10 @@ silent! set ttymouse= " Keep undo files, hopefully in a dedicated directory if has('persistent_undo') set undofile - set undodir^=~/.vim/cache/undo// if has('win32') || has('win64') - set undodir-=~/.vim/cache/undo// set undodir^=~/vimfiles/cache/undo// + else + set undodir^=~/.vim/cache/undo// endif endif -- cgit v1.2.3 From 4211cc3ac7460a950fb682398ced3d9bcb7f5193 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 26 Nov 2018 09:29:17 +1300 Subject: Move b:undo_ftplugin unsets for C inline with sets --- vim/after/ftplugin/c.vim | 5 +++-- vim/after/ftplugin/cpp.vim | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'vim') diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index 9ac59733..da34d269 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -5,13 +5,14 @@ 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 - -let b:undo_ftplugin .= '|setlocal complete< include< path<' diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim index b5596613..4042fb84 100644 --- a/vim/after/ftplugin/cpp.vim +++ b/vim/after/ftplugin/cpp.vim @@ -5,13 +5,14 @@ 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 - -let b:undo_ftplugin .= '|setlocal complete< include< path<' -- cgit v1.2.3 From 478774d1c1cadf12265b50e99e086931fd689533 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 26 Nov 2018 21:27:53 +1300 Subject: Correct indentation in a few vim/after scripts --- vim/after/ftplugin/gitcommit.vim | 2 +- vim/after/ftplugin/html.vim | 6 +++--- vim/after/ftplugin/vim.vim | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'vim') diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index c9b14b6b..2dc5fa37 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -12,7 +12,7 @@ let b:undo_ftplugin .= '|setlocal comments< formatoptions<' if has('autocmd') && exists('+cursorcolumn') augroup gitcommit autocmd CursorMoved,CursorMovedI - \ let &l:colorcolumn = gitcommit#CursorColumn() + \ let &l:colorcolumn = gitcommit#CursorColumn() augroup END let b:undo_ftplugin .= '|autocmd! gitcommit' \ . '|augroup! gitcommit' diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index dc429221..759d06bf 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -12,9 +12,9 @@ let b:undo_ftplugin .= '|unlet b:current_compiler' " Set up hooks for timestamp updating augroup html_timestamp autocmd BufWritePre - \ if exists('b:html_timestamp_check') - \| call html#TimestampUpdate() - \|endif + \ if exists('b:html_timestamp_check') + \| call html#TimestampUpdate() + \|endif augroup END let b:undo_ftplugin .= '|autocmd! html_timestamp BufWritePre ' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 46182627..2fc5bd78 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -24,15 +24,15 @@ let b:undo_ftplugin .= '|nunmap K' " 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 ["' + \ . '|vunmap [[' + \ . '|nunmap ]]' + \ . '|vunmap ]]' + \ . '|nunmap []' + \ . '|vunmap []' + \ . '|nunmap ][' + \ . '|vunmap ][' + \ . '|nunmap ]"' + \ . '|vunmap ]"' + \ . '|nunmap ["' + \ . '|vunmap ["' endif -- cgit v1.2.3