neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

nohlsearch.vim (514B)


      1 " nohlsearch.vim: Auto turn off hlsearch
      2 " Last Change: 2025-03-08
      3 " Maintainer: Maxim Kim <habamax@gmail.com>
      4 "
      5 " turn off hlsearch after:
      6 " - doing nothing for 'updatetime'
      7 " - getting into insert mode
      8 
      9 if exists('g:loaded_nohlsearch')
     10    finish
     11 endif
     12 let g:loaded_nohlsearch = 1
     13 
     14 func! s:Nohlsearch()
     15    if v:hlsearch
     16        call feedkeys("\<cmd>nohlsearch\<cr>", 'm')
     17    endif
     18 endfunc
     19 
     20 augroup nohlsearch
     21    au!
     22    au CursorHold * call s:Nohlsearch()
     23    au InsertEnter * call s:Nohlsearch()
     24 augroup END