aboutsummaryrefslogtreecommitdiff
path: root/plugin/insert_suspend_hlsearch.vim
blob: 2a88e8a7b6d02caacd335f50284ef9d89a9fdd85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"
" insert_suspend_hlsearch.vim: If 'hlsearch' is enabled, switch it off when
" the user starts an insert mode operation, and back on again when they're
" done.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('loaded_insert_suspend_hlsearch') || &compatible && v:version < 700
  finish
endif
let loaded_insert_suspend_hlsearch = 1

" Clear search highlighting as soon as I enter insert mode, and restore it
" once left
augroup insert_suspend_hlsearch
  autocmd!
  autocmd InsertEnter *
        \ call insert_suspend_hlsearch#Suspend()
  autocmd InsertLeave *
        \ call insert_suspend_hlsearch#Restore()
augroup END