From 0064da097f13e1c1a8843308572976a436b15e28 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 28 May 2018 11:47:01 +1200 Subject: Use _save suffix for option caching variable This makes it explicit what the variable is for, in the same way as s:cpoptions_save in vim/vimrc. --- vim/plugin/copy_linebreak.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim index 0924134c..a7d8a3e5 100644 --- a/vim/plugin/copy_linebreak.vim +++ b/vim/plugin/copy_linebreak.vim @@ -17,7 +17,7 @@ let g:loaded_copy_linebreak = 1 " Enable copy-friendly linebreak options function! s:CopyLinebreakEnable() setlocal nolinebreak linebreak? - let s:showbreak = &showbreak + let s:showbreak_save = &showbreak set showbreak= if exists('+breakindent') setlocal nobreakindent @@ -27,7 +27,7 @@ endfunction " Disable copy-friendly linebreak options function! s:CopyLinebreakDisable() setlocal linebreak linebreak? - let &showbreak = s:showbreak + let &showbreak = s:showbreak_save if exists('+breakindent') setlocal breakindent< endif -- cgit v1.2.3 From 9f3a6174b536ac709c1f873d7b5cb21fbb9407ac Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 22:33:36 +1200 Subject: Remove untidy comment --- vim/plugin/insert_suspend_hlsearch.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/vim/plugin/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim index e7e2664d..e82fd00a 100644 --- a/vim/plugin/insert_suspend_hlsearch.vim +++ b/vim/plugin/insert_suspend_hlsearch.vim @@ -9,7 +9,6 @@ if exists('g:loaded_insert_suspend_hlsearch') || &compatible finish endif -" InsertEnter isn't an autocmd event until 7.0 if !has('autocmd') || v:version < 700 finish endif -- cgit v1.2.3 From e55f2b8f62dfc0fef9b93e982b908b4500f07ab2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 22:34:39 +1200 Subject: Require +extra_search feat for 'hlsearch' suspend --- vim/plugin/insert_suspend_hlsearch.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/plugin/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim index e82fd00a..d3825132 100644 --- a/vim/plugin/insert_suspend_hlsearch.vim +++ b/vim/plugin/insert_suspend_hlsearch.vim @@ -9,7 +9,7 @@ if exists('g:loaded_insert_suspend_hlsearch') || &compatible finish endif -if !has('autocmd') || v:version < 700 +if !has('autocmd') || !has('extra_search') || v:version < 700 finish endif let g:loaded_insert_suspend_hlsearch = 1 -- cgit v1.2.3 From 680f313c71e4ab642f27ae299b8c2af8ba8570de Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 22:35:05 +1200 Subject: Tidy comments, func names for 'hlsearch' suspend --- vim/plugin/insert_suspend_hlsearch.vim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/vim/plugin/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim index d3825132..b916ac42 100644 --- a/vim/plugin/insert_suspend_hlsearch.vim +++ b/vim/plugin/insert_suspend_hlsearch.vim @@ -14,9 +14,10 @@ if !has('autocmd') || !has('extra_search') || v:version < 700 endif let g:loaded_insert_suspend_hlsearch = 1 -" When entering insert mode, copy the current value of the 'hlsearch' option -" into a script variable; if it's enabled, suspend it -function s:InsertEnter() +" Save the current value of the 'hlsearch' option in a script variable, and +" disable it if enabled. Note that :nohlsearch does not work for this; see +" :help autocmd-searchpat. +function s:HlsearchSuspend() let s:hlsearch = &hlsearch if s:hlsearch set nohlsearch @@ -24,9 +25,9 @@ function s:InsertEnter() return endfunction -" When leaving insert mode, if 'hlsearch' was enabled when this operation -" started, restore it -function s:InsertLeave() +" Restore the value of 'hlsearch' from the last time s:HlsearchSuspend was +" called. +function s:HlsearchRestore() if s:hlsearch set hlsearch endif @@ -34,13 +35,13 @@ function s:InsertLeave() endfunction " Clear search highlighting as soon as I enter insert mode, and restore it -" once I leave it +" once left augroup insert_suspend_hlsearch autocmd! autocmd InsertEnter \ * - \ call InsertEnter() + \ call HlsearchSuspend() autocmd InsertLeave \ * - \ call InsertLeave() + \ call HlsearchRestore() augroup END -- cgit v1.2.3 From 9f0008c7df9679d051751a27489257767a68850c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 22:42:57 +1200 Subject: Add feat requirements to hlsearch suspend doc --- vim/doc/insert_suspend_hlsearch.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vim/doc/insert_suspend_hlsearch.txt b/vim/doc/insert_suspend_hlsearch.txt index edb51e38..a6465935 100644 --- a/vim/doc/insert_suspend_hlsearch.txt +++ b/vim/doc/insert_suspend_hlsearch.txt @@ -1,4 +1,4 @@ -*insert_suspend_hlsearch.txt* For Vim version 7.0 Last change: 2017 November 12 +*insert_suspend_hlsearch.txt* For Vim version 7.0 Last change: 2018 May 30 DESCRIPTION *insert_suspend_hlsearch* @@ -8,7 +8,8 @@ distracting effect the highlighting can cause while writing. REQUIREMENTS *insert_suspend_hlsearch-requirements* -This plugin is only available if 'compatible' is not set. +This plugin is only available if 'compatible' is not set. It also requires the +|+autocmd| and |+extra_search| features. AUTHOR *insert_suspend_hlsearch-author* -- cgit v1.2.3 From a3298a0ce98795a6f005490bcc45130f8254d4a2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:03:29 +1200 Subject: Spin off insert_suspend_hlsearch Vim plugin --- .gitmodules | 3 +++ Makefile | 7 ----- vim/bundle/insert_suspend_hlsearch | 1 + vim/doc/insert_suspend_hlsearch.txt | 29 --------------------- vim/plugin/insert_suspend_hlsearch.vim | 47 ---------------------------------- 5 files changed, 4 insertions(+), 83 deletions(-) create mode 160000 vim/bundle/insert_suspend_hlsearch delete mode 100644 vim/doc/insert_suspend_hlsearch.txt delete mode 100644 vim/plugin/insert_suspend_hlsearch.vim diff --git a/.gitmodules b/.gitmodules index 7371c759..045bb6f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,9 @@ [submodule "vim/bundle/commentary"] path = vim/bundle/commentary url = https://sanctum.geek.nz/clone/vim-commentary.git +[submodule "vim/bundle/insert_suspend_hlsearch"] + path = vim/bundle/insert_suspend_hlsearch + url = https://sanctum.geek.nz/code/vim-insert-suspend-hlsearch.git [submodule "vim/bundle/juvenile"] path = vim/bundle/juvenile url = https://sanctum.geek.nz/code/vim-juvenile.git diff --git a/Makefile b/Makefile index c194dc9e..def064d6 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,6 @@ dist-vim-plugin-command-typos \ dist-vim-plugin-copy-linebreak \ dist-vim-plugin-fixed-join \ - dist-vim-plugin-insert-suspend-hlsearch \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace \ dist-vim-plugin-toggle-option-flag @@ -680,7 +679,6 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-copy-linebreak \ dist-vim-plugin-detect-background \ dist-vim-plugin-fixed-join \ - dist-vim-plugin-insert-suspend-hlsearch \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace \ dist-vim-plugin-toggle-option-flag @@ -725,11 +723,6 @@ dist-vim-plugin-fixed-join: \ vim/doc/fixed_join.txt \ VERSION sh dist/vim-plugin.sh fixed_join -dist-vim-plugin-insert-suspend-hlsearch: \ - vim/plugin/insert_suspend_hlsearch.vim \ - vim/doc/insert_suspend_hlsearch.txt \ - VERSION - sh dist/vim-plugin.sh insert_suspend_hlsearch dist-vim-plugin-mail-mutt: \ vim/plugin/mail_mutt.vim \ vim/doc/mail_mutt.txt \ diff --git a/vim/bundle/insert_suspend_hlsearch b/vim/bundle/insert_suspend_hlsearch new file mode 160000 index 00000000..a1f580c7 --- /dev/null +++ b/vim/bundle/insert_suspend_hlsearch @@ -0,0 +1 @@ +Subproject commit a1f580c76e5af568235cc03582f4310298be7328 diff --git a/vim/doc/insert_suspend_hlsearch.txt b/vim/doc/insert_suspend_hlsearch.txt deleted file mode 100644 index a6465935..00000000 --- a/vim/doc/insert_suspend_hlsearch.txt +++ /dev/null @@ -1,29 +0,0 @@ -*insert_suspend_hlsearch.txt* For Vim version 7.0 Last change: 2018 May 30 - -DESCRIPTION *insert_suspend_hlsearch* - -This plugin quietly disables 'hlsearch' search highlighting if enabled when an -insert operation is started, and puts it back once done, to avoid the -distracting effect the highlighting can cause while writing. - -REQUIREMENTS *insert_suspend_hlsearch-requirements* - -This plugin is only available if 'compatible' is not set. It also requires the -|+autocmd| and |+extra_search| features. - -AUTHOR *insert_suspend_hlsearch-author* - -Written and maintained by Tom Ryder . - -LICENSE *insert_suspend_hlsearch-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *insert_suspend_hlsearch-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/plugin/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim deleted file mode 100644 index b916ac42..00000000 --- a/vim/plugin/insert_suspend_hlsearch.vim +++ /dev/null @@ -1,47 +0,0 @@ -" -" insert_suspend_hlsearch.vim: If 'hlsearch' is enabled, switch it off when -" the user starts an insert mode operation, and back on again when they're -" done. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_insert_suspend_hlsearch') || &compatible - finish -endif -if !has('autocmd') || !has('extra_search') || v:version < 700 - finish -endif -let g:loaded_insert_suspend_hlsearch = 1 - -" Save the current value of the 'hlsearch' option in a script variable, and -" disable it if enabled. Note that :nohlsearch does not work for this; see -" :help autocmd-searchpat. -function s:HlsearchSuspend() - let s:hlsearch = &hlsearch - if s:hlsearch - set nohlsearch - endif - return -endfunction - -" Restore the value of 'hlsearch' from the last time s:HlsearchSuspend was -" called. -function s:HlsearchRestore() - if s:hlsearch - set hlsearch - endif - return -endfunction - -" Clear search highlighting as soon as I enter insert mode, and restore it -" once left -augroup insert_suspend_hlsearch - autocmd! - autocmd InsertEnter - \ * - \ call HlsearchSuspend() - autocmd InsertLeave - \ * - \ call HlsearchRestore() -augroup END -- cgit v1.2.3 From 1a760892446c047fd451bd0ad93f21769c0443cc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:05:45 +1200 Subject: Add some structure to .gitmodules --- .gitmodules | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index 045bb6f5..90217ff7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,24 @@ -[submodule "vim/bundle/abolish"] - path = vim/bundle/abolish - url = https://sanctum.geek.nz/clone/vim-abolish.git -[submodule "vim/bundle/commentary"] - path = vim/bundle/commentary - url = https://sanctum.geek.nz/clone/vim-commentary.git +# My Vim plugins [submodule "vim/bundle/insert_suspend_hlsearch"] path = vim/bundle/insert_suspend_hlsearch url = https://sanctum.geek.nz/code/vim-insert-suspend-hlsearch.git [submodule "vim/bundle/juvenile"] path = vim/bundle/juvenile url = https://sanctum.geek.nz/code/vim-juvenile.git -[submodule "vim/bundle/repeat"] - path = vim/bundle/repeat - url = https://sanctum.geek.nz/clone/vim-repeat.git [submodule "vim/bundle/sahara"] path = vim/bundle/sahara url = https://sanctum.geek.nz/code/vim-sahara.git + +# Others' Vim plugins +[submodule "vim/bundle/abolish"] + path = vim/bundle/abolish + url = https://sanctum.geek.nz/clone/vim-abolish.git +[submodule "vim/bundle/commentary"] + path = vim/bundle/commentary + url = https://sanctum.geek.nz/clone/vim-commentary.git +[submodule "vim/bundle/repeat"] + path = vim/bundle/repeat + url = https://sanctum.geek.nz/clone/vim-repeat.git [submodule "vim/bundle/surround"] path = vim/bundle/surround url = https://sanctum.geek.nz/clone/vim-surround.git -- cgit v1.2.3 From 51f470873f2f5b2ff60a07424ac8818175773278 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:08:00 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index fd7c31de..da1e5892 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v0.34.1 -Wed May 30 22:06:44 NZST 2018 +tejr dotfiles v0.35.0 +Wed May 30 11:07:48 UTC 2018 -- cgit v1.2.3