HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Program Files/Git/usr/share/vim/vim91/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
" nohlsearch.vim: Auto turn off hlsearch
" Last Change: 2025-03-08
" Maintainer: Maxim Kim <[email protected]>
"
" 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