aboutsummaryrefslogtreecommitdiff
path: root/autoload/insert_suspend_hlsearch.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-25 22:49:16 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-25 22:49:16 +1200
commit0378547786e68b7825fa4893efd7cd240202f121 (patch)
tree6b4ae466361f32d3f82cbea2f997179c2aa94946 /autoload/insert_suspend_hlsearch.vim
parent39e9abea82f6485cc429f05a03f63c9cabf086c6 (diff)
parentdff129a209be7262bfbe021a866d0569d5e65b21 (diff)
downloadvim-insert-suspend-hlsearch-0378547786e68b7825fa4893efd7cd240202f121.tar.gz
vim-insert-suspend-hlsearch-0378547786e68b7825fa4893efd7cd240202f121.zip
Merge branch 'release/v1.0.0'v1.0.0
* release/v1.0.0: Overhaul with autoloading for new version
Diffstat (limited to 'autoload/insert_suspend_hlsearch.vim')
-rw-r--r--autoload/insert_suspend_hlsearch.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/autoload/insert_suspend_hlsearch.vim b/autoload/insert_suspend_hlsearch.vim
new file mode 100644
index 0000000..4961ed9
--- /dev/null
+++ b/autoload/insert_suspend_hlsearch.vim
@@ -0,0 +1,14 @@
+" Save value of 'hlsearch' into a variable, and disable it
+function! insert_suspend_hlsearch#Suspend() abort
+ let s:hlsearch = &hlsearch
+ let &hlsearch = 0
+endfunction
+
+" Restore the value of 'hlsearch' if suspended
+function! insert_suspend_hlsearch#Restore() abort
+ if !exists('s:hlsearch')
+ return
+ endif
+ let &hlsearch = s:hlsearch
+ unlet s:hlsearch
+endfunction