mirror of
https://github.com/neovim/neovim.git
synced 2025-11-09 20:15: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
|
" nohlsearch.vim: Auto turn off hlsearch
|
||||||
" Last Change: 2024-07-31
|
" Last Change: 2025-03-08
|
||||||
" Maintainer: Maxim Kim <habamax@gmail.com>
|
" Maintainer: Maxim Kim <habamax@gmail.com>
|
||||||
"
|
"
|
||||||
" turn off hlsearch after:
|
" turn off hlsearch after:
|
||||||
@@ -11,10 +11,14 @@ if exists('g:loaded_nohlsearch')
|
|||||||
endif
|
endif
|
||||||
let g:loaded_nohlsearch = 1
|
let g:loaded_nohlsearch = 1
|
||||||
|
|
||||||
|
func! s:Nohlsearch()
|
||||||
|
if v:hlsearch
|
||||||
|
call feedkeys("\<cmd>nohlsearch\<cr>", 'm')
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
augroup nohlsearch
|
augroup nohlsearch
|
||||||
au!
|
au!
|
||||||
noremap <Plug>(nohlsearch) <cmd>nohlsearch<cr>
|
au CursorHold * call s:Nohlsearch()
|
||||||
noremap! <Plug>(nohlsearch) <cmd>nohlsearch<cr>
|
au InsertEnter * call s:Nohlsearch()
|
||||||
au CursorHold * call feedkeys("\<Plug>(nohlsearch)", 'm')
|
|
||||||
au InsertEnter * call feedkeys("\<Plug>(nohlsearch)", 'm')
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|||||||
Reference in New Issue
Block a user