pocco81 / high-str.nvim

🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!
GNU General Public License v3.0
306 stars 2 forks source link

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

Closed hunleyd closed 3 years ago

hunleyd commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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>