vim-cool
vim-cool copied to clipboard
Toggling on/off
Sometimes, I want just want to <C-d> through a document without losing the highlights.
It would be useful to implement a command or option for toggling vim-cool on/off.
:VimCoolToggle
Hmm, :VimCoolToggle sounds a lot like the :nohlsearch this plugin is specifically designed to eradicate.
99% of the time, I want highlighting to disappear upon navigation. But there's a small 1% where it is useful to revert to the default behavior.
Imagine searching for this in a file:
this this this this
...many lines...
this this this this lorem ipsum
this this this this dolor sit
this this this this amet
...many lines...
this <-- this "this" is what we were looking for
Instead of pressing n repeatedly, it's faster to <C-f> a few times.
I don't use /? to "search", only to "navigate" to a specific thing, usually in the visible part of the buffer. For actually "searching" I generally use :g.
Anyway, what you ask for should be doable but I doubt I will have time to look into it before January.
I'm a +1 on this. Thanks @romainl for showing consideration even though you personally find this nonsensical---uncommonly generous.
+1, I use / only to search through document and I always keep them highlighted.
quick and dirty solution, for now change cool.vim as below:
function! s:PlayItCool(old, new)
if a:old == 0 && a:new == 1
" nohls --> hls
" set up coolness
" noremap <silent> <Plug>(StopHL) :<C-U>nohlsearch<cr>
" if !exists('*execute')
" noremap! <expr> <Plug>(StopHL) <SID>AuNohlsearch()
" else
" noremap! <expr> <Plug>(StopHL) execute('nohlsearch')[-1]
" endif
" autocmd Cool CursorMoved * call <SID>StartHL()
" autocmd Cool InsertEnter * call <SID>StopHL()
elseif a:old == 1 && a:new == 0