runtime(nohlsearch): fix CursorHold loop Commit: https://github.com/vim/vim/commit/ce4f9d2a1016ade19fa07c5b66e58eb084719192 Author: qaqland <q...@qaq.land> Date: Sat Mar 8 17:16:18 2025 +0100
runtime(nohlsearch): fix CursorHold loop fix exception when entering the insert mode with paste closes: #16818 Co-authored-by: Maxim Kim <haba...@gmail.com> Signed-off-by: qaqland <q...@qaq.land> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim index a2d766e41..58613a2f0 100644 --- a/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim +++ b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim @@ -1,5 +1,5 @@ " nohlsearch.vim: Auto turn off hlsearch -" Last Change: 2024-07-31 +" Last Change: 2025-03-08 " Maintainer: Maxim Kim <haba...@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 -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1tqx3r-00G3F7-Eb%40256bit.org.