Select All and Copy from VIM

I often use the VIM text editor to compose short notes or text documents which I later have to copy over to another application. Here is how you can select all lines from VIM and copy them to your system clipboard:

gg"+yG

You can also use:

:%yank+

or

:%y+

Sources:
1. http://vim.wikia.com/wiki/Copy_an_Entire_Buffer_to_the_Clipboard
2. http://stackoverflow.com/questions/1620018/copy-all-the-lines-to-clipboard
3. https://groups.google.com/forum/#!searchin/vim_use/clipboard$20copy$20and$20past/vim_use/4pDsJO8hxQk/j3tqwwd3XUcJ

vim
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License