summaryrefslogtreecommitdiffstats
path: root/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
blob: 6cfe813cfa273e8cf3859c040ebf721760ff1405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
" nohlsearch.vim: Auto turn off hlsearch
" Last Change: 2024-06-18
" Maintainer: Maxim Kim <habamax@gmail.com>
"
" turn off hlsearch after:
" - doing nothing for 'updatetime'
" - getting into insert mode
augroup nohlsearch
    au!
    noremap <Plug>(nohlsearch) <cmd>nohlsearch<cr>
    noremap! <expr> <Plug>(nohlsearch) execute('nohlsearch')[-1]
    au CursorHold * call feedkeys("\<Plug>(nohlsearch)", 'm')
    au InsertEnter * call feedkeys("\<Plug>(nohlsearch)", 'm')
augroup END