aboutsummaryrefslogtreecommitdiff
path: root/autoload/insert_suspend_hlsearch.vim
blob: 4961ed9135282510fb0361084e67431dcd22f889 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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