vim/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
qaqland ce4f9d2a10
runtime(nohlsearch): fix CursorHold loop
fix exception when entering the insert mode with paste

closes: #16818

Co-authored-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: qaqland <qaq@qaq.land>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-08 17:16:18 +01:00

24 lines
514 B
VimL

" nohlsearch.vim: Auto turn off hlsearch
" Last Change: 2025-03-08
" Maintainer: Maxim Kim <habamax@gmail.com>
"
" turn off hlsearch after:
" - doing nothing for 'updatetime'
" - getting into insert mode
if exists('g:loaded_nohlsearch')
finish
endif
let g:loaded_nohlsearch = 1
func! s:Nohlsearch()
if v:hlsearch
call feedkeys("\<cmd>nohlsearch\<cr>", 'm')
endif
endfunc
augroup nohlsearch
au!
au CursorHold * call s:Nohlsearch()
au InsertEnter * call s:Nohlsearch()
augroup END