Vim highlight characters/words/line for Copy to clipboard

Tag: vim Author: spenser88 Date: 2009-07-20

I am fairly new to vim. I am trying to practice (been reading a couple of tutorials lately) but I found out I couldn't live without highlighting characters/words/lines for Copy-paste.

In Textmate, I usually SHIFT+CTRL+LeftArrowKey to highlight words and then Copy.

How do I do that in VIM?

NOTE: I have NERDTree plugin installed and mapped some keys for my own consumption.

Best Answer

Give a look to the Vim Visual Mode.

The Shift+Ctrl+LeftArrowKey for word highlighting can be replaced easily for vw or vb.

Highlighting lines :

V to enter in Visual Line mode, then you can move with j,k, Ctrl-U, Ctrl-D, etc...

The Visual Mode is very powerful and useful.

Also, give a look to my answer to this question.


Thank you so much for this. On a sidenote, is it possible to have Vim (w/ NERDTree) to access files via FTP? I am still researching on this and thought asking here would also help.

Other Answer1

I am using VIM on Windows right now and in my .vimrc I have the following:

if has("win32")
   set clipboard=unnamed "always copy into clipboard
   set go+=a " when I am selecting anything, it is autamtically copied 
             " into clipboard

I don't have any Linux machine right now with me, but I think, that it should work on Linux too. (maybe it will require some hacking)


There are lots of usefull tips about yanking(copying) here: Vim Wikia