aboutsummaryrefslogtreecommitdiff
path: root/plugin/insert_suspend_hlsearch.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/insert_suspend_hlsearch.vim')
-rw-r--r--plugin/insert_suspend_hlsearch.vim27
1 files changed, 2 insertions, 25 deletions
diff --git a/plugin/insert_suspend_hlsearch.vim b/plugin/insert_suspend_hlsearch.vim
index afd8800..5dd1e74 100644
--- a/plugin/insert_suspend_hlsearch.vim
+++ b/plugin/insert_suspend_hlsearch.vim
@@ -14,33 +14,10 @@ if !has('autocmd') || !has('extra_search') || v:version < 700
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_save = &hlsearch
- if s:hlsearch_save
- set nohlsearch
- endif
-endfunction
-
-" Restore the value of 'hlsearch' from the last time s:HlsearchSuspend was
-" called.
-function! s:HlsearchRestore()
- if s:hlsearch_save
- set hlsearch
- endif
- unlet s:hlsearch_save
-endfunction
-
" Clear search highlighting as soon as I enter insert mode, and restore it
" once left
augroup insert_suspend_hlsearch
autocmd!
- autocmd InsertEnter
- \ *
- \ call <SID>HlsearchSuspend()
- autocmd InsertLeave
- \ *
- \ call <SID>HlsearchRestore()
+ autocmd InsertEnter * call insert_suspend_hlsearch#Suspend()
+ autocmd InsertLeave * call insert_suspend_hlsearch#Restore()
augroup END