Open tammersaleh opened 5 years ago
I've found a solution. Add the following snippet to the .vimrc
.
augroup incsearch_settings
autocmd!
autocmd BufWinLeave,WinLeave * call s:clear_incsearch_nohlsearch()
augroup END
function! s:clear_incsearch_nohlsearch()
nohlsearch
silent! autocmd! incsearch-auto-nohlsearch
endfunction
Because g:incsearch#auto_nohlsearch = 1
, incsearch.vim will create autocmd after search that will execute :nohlsearch
on CursorMoved
. But in terminal mode, that command will be directly send to your shell without executing. The above snippet will clear the autocmd on BufWinLeave
and WinLeave
which will happen when you leave current window or leave current buffer.
I use
:term
in Vim 8.0, and every so often when switching to a terminal window, incsearch seems to send(_incsearch-nohlsearch)
to the command line:If I hit enter, then the text is sent to bash, so it's not a visual artifact. The relevant vimrc snippet is: