Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim enters into visual mode on selecting text after El Capitan update

Issue is what the title says. Earlier I used to copy text from text files open in vim simply by selecting text and doing Ctrl + C. But now it puts me into visual mode, thus not allowing to copy the text. Its really annoying. Anybody knows any fix for this.

Thanks.

like image 574
pratpor Avatar asked Oct 12 '15 09:10

pratpor


People also ask

What is visual mode vim?

Visual Block Mode of Vim allows us to perform different operations like delete, copy-paste, i.e., yanked and put, etc. To enable the Visual block mode in Vim, you have to try out the “Ctrl+V” command within the normal mode. You can see that the new. txt file has been opened in the Visual Block mode.

What is set mouse A?

If you want ":set mouse=a" to work over SSH, just use the '-X' option when using SSH. If using vim in xterm and having set mouse=a, you will notice mouse middle-click paste no longer seems to work. Instead use Shift+middle-click to paste X selection.

How do I select a block in vim?

Press v to begin character-based visual selection, or V to select whole lines, or Ctrl-v or Ctrl-q to select a block. Move the cursor to the end of the text to be cut/copied.


1 Answers

You probably have the mouse mode active. You can turn it off with:

:set mouse=

And turn it back on with

:set mouse=a

If you are using iTerm, you can leave mouse mode on all the time if you want, and hold Option when you want to select without using visual mode. I am not aware of a way to do that in OS X Terminal.

Update (from Younes in comments): For Terminal.app on El Capitan, press the Fn key to bypass the mouse mode. See this question for more.

like image 56
Dan Lowe Avatar answered Oct 30 '22 13:10

Dan Lowe