aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-05 22:28:05 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-05 22:28:05 +1200
commit8679b3bb7124d3fe44d260ebec202c92d6695bcc (patch)
tree4a1014ff0687647696ddc764b3b3f035f7ff8b55 /autoload
parent0378547786e68b7825fa4893efd7cd240202f121 (diff)
parentfd99bfd2133e481479021b1aeeb7904512871ff0 (diff)
downloadvim-insert-suspend-hlsearch-8679b3bb7124d3fe44d260ebec202c92d6695bcc.tar.gz
vim-insert-suspend-hlsearch-8679b3bb7124d3fe44d260ebec202c92d6695bcc.zip
Merge branch 'release/v2.0.0'v2.0.0
* release/v2.0.0: Refactor with dynamic autocmd hook
Diffstat (limited to 'autoload')
-rw-r--r--autoload/insert_suspend_hlsearch.vim16
1 files changed, 5 insertions, 11 deletions
diff --git a/autoload/insert_suspend_hlsearch.vim b/autoload/insert_suspend_hlsearch.vim
index 4961ed9..de43d10 100644
--- a/autoload/insert_suspend_hlsearch.vim
+++ b/autoload/insert_suspend_hlsearch.vim
@@ -1,14 +1,8 @@
" Save value of 'hlsearch' into a variable, and disable it
-function! insert_suspend_hlsearch#Suspend() abort
+function! insert_suspend_hlsearch#() 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
+ set nohlsearch
+ autocmd insert_suspend_hlsearch InsertLeave *
+ \ let &hlsearch = s:hlsearch
+ \|autocmd! insert_suspend_hlsearch InsertLeave
endfunction