0

Whenever I use vim, sometimes I make a single-touch touchpad on vim screen and it makes a highlight like the picture below.

The problem is this I cannot cancel this highlight. right click doesn't work, left click just override highlight to that clicked point again.

Only way to get rid of this is to quit vim.
Anyone else have this problem?

I am currently considering disabling mouse click on vim but i am looking for a better solution.

Many thanks in advance

enter image description here

enter image description here

  • That may be a dumb question but doesn't pressing <esc> remove the highlight? On your screenshot you are in visual line, usually <esc> quits this mode. – statox Feb 8 '17 at 7:32
  • No. That mouse highlighted selections are separate to vims one. I can also highlight using keyboard alongside that.. – zcahfg2 Feb 8 '17 at 9:03
  • Ok I just wanted to be sure that wasn't something trivial like that. I'm not a mac user so I hope someone else can answer your question :) – statox Feb 8 '17 at 9:05
  • 1
    Are you sure this highlight is vim-related? In my terminal (which seems to be the same as yours) the selection disappear as soon as I press a key. Also can you list your Vim version and terminal version? – nobe4 Feb 8 '17 at 13:57
  • Hello I am running vim 8.0 inside tmux 2.3 from terminal (Mac OS Sierra). The problem is this mouse highlighting is done by the terminal itself and when it is done inside vim, there seems to be no way to cancel this highlighting unless I quit vim. I have added a screenshot in the question to reflect this. The second screenshot shows two distinct highlights - one from the terminal and another from vim using keyboard. If I cancel the visual selection there only the keyboard highlights would disappear. – zcahfg2 Feb 8 '17 at 21:37
2

You can use fn to bypass Mouse Reporting for programs like vim. (i.e. do fn+left-mouse button to clear the selection.)

Source: https://superuser.com/questions/125102/mac-os-x-terminal-mouse-support/985865#985865

(If you are not using a Mac and you are having a similar issue, you can use ctrl-z to suspend vim. Once you are done doing whatever, execute the fg command to bring vim back up.)

  • Wow! finally! Thank you so much.. I would always quit vim and reload if this happened... – zcahfg2 Nov 3 '17 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.