blob: 3000ac1379bcbd3e0e40b473590b23a9ddfaa292 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
" Initialise option saving variable
if !exists('g:insert_suspend_hlsearch#save')
let g:insert_suspend_hlsearch#save = 0
endif
" 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! insert_suspend_hlsearch#Suspend() abort
let g:insert_suspend_hlsearch#save = &hlsearch
if g:insert_suspend_hlsearch#save
set nohlsearch
endif
endfunction
" Restore the value of 'hlsearch' from the last time s:HlsearchSuspend was
" called.
function! insert_suspend_hlsearch#Restore() abort
if g:insert_suspend_hlsearch#save
set hlsearch
unlet g:insert_suspend_hlsearch#save
endif
endfunction
|