mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
vim-patch:ce4f9d2: runtime(nohlsearch): fix CursorHold loop (#36221)
fix exception when entering the insert mode with paste
closes: vim/vim#16818
ce4f9d2a10
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
" nohlsearch.vim: Auto turn off hlsearch
|
||||
" Last Change: 2024-07-31
|
||||
" Last Change: 2025-03-08
|
||||
" Maintainer: Maxim Kim <habamax@gmail.com>
|
||||
"
|
||||
" turn off hlsearch after:
|
||||
@@ -11,10 +11,14 @@ if exists('g:loaded_nohlsearch')
|
||||
endif
|
||||
let g:loaded_nohlsearch = 1
|
||||
|
||||
func! s:Nohlsearch()
|
||||
if v:hlsearch
|
||||
call feedkeys("\<cmd>nohlsearch\<cr>", 'm')
|
||||
endif
|
||||
endfunc
|
||||
|
||||
augroup nohlsearch
|
||||
au!
|
||||
noremap <Plug>(nohlsearch) <cmd>nohlsearch<cr>
|
||||
noremap! <Plug>(nohlsearch) <cmd>nohlsearch<cr>
|
||||
au CursorHold * call feedkeys("\<Plug>(nohlsearch)", 'm')
|
||||
au InsertEnter * call feedkeys("\<Plug>(nohlsearch)", 'm')
|
||||
au CursorHold * call s:Nohlsearch()
|
||||
au InsertEnter * call s:Nohlsearch()
|
||||
augroup END
|
||||
|
||||
Reference in New Issue
Block a user