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

how to auto-enable/disable when entering/exiting visual mode #5

Closed
hunleyd opened this issue Aug 6, 2021 · 2 comments
Closed

how to auto-enable/disable when entering/exiting visual mode #5

hunleyd opened this issue Aug 6, 2021 · 2 comments

Comments

@hunleyd
Copy link

hunleyd commented Aug 6, 2021

Is there a way to set up an autocmd (or something) to call HSHighlight when entering visual mode and then call HSRmHighlight when exiting visual mode? I have them mapped to F3/F4 as shown in the README but having 'the system' do it automatically would be even better.

@pocco81
Copy link
Owner

pocco81 commented Aug 6, 2021

Hey! what exactly do you need? Calling HSHighlight as soon as you enter visual mode will only highlight the current character/thing you are over at the moment and calling HSRmHighlight will remove the highlights from the current line. That doesn't make sense.

Perhaps you meant to run HSHighlight after exiting visual mode in order to highlight what you selected? That's how the highlighter works in normal document editors.

@pocco81
Copy link
Owner

pocco81 commented Aug 6, 2021

Nope, after searching for a while it concluded that it's not possible to do this:

I'd suggest you simply use a more "simple" mapping, like pressing h to highlight visual selection:

vnoremap <silent> h :<c-u>HSHighlight 1<CR>

@pocco81 pocco81 closed this as completed Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants