Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggling on/off #36

Open
YodaEmbedding opened this issue Nov 23, 2019 · 6 comments
Open

Toggling on/off #36

YodaEmbedding opened this issue Nov 23, 2019 · 6 comments

Comments

@YodaEmbedding
Copy link

YodaEmbedding commented Nov 23, 2019

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
@romainl
Copy link
Owner

romainl commented Nov 23, 2019

Hmm, :VimCoolToggle sounds a lot like the :nohlsearch this plugin is specifically designed to eradicate.

@YodaEmbedding
Copy link
Author

YodaEmbedding commented Nov 24, 2019

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.

@romainl
Copy link
Owner

romainl commented Nov 24, 2019

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.

@kevinlawler
Copy link

I'm a +1 on this. Thanks @romainl for showing consideration even though you personally find this nonsensical---uncommonly generous.

@tmpm697
Copy link

tmpm697 commented May 15, 2020

+1, I use / only to search through document and I always keep them highlighted.

@tmpm697
Copy link

tmpm697 commented May 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants