How to copy from vim to system clipboard?

Today I spent more than one hour to figure out this problem. Following steps might be helpful if you have similar problem.

1. Use :reg to check whether there is "+ register in your vim. If not, you need to update your vim. This happens if you got your vim from apt-get and did not install useful dependencies. See this for more details.

2. Once you have "+ register, you should be able to use +"y instead of y when you are copying.

3. You can map a short key for this: for example, I use vmap <c-c> "+y (Ctrl+C for copy). Add this to .vimrc file.

4. Also, use set go+=a and set mouse+= a such that you could select the text using mouse and then click Ctrl+C to copy. Here set go+=a is used for avoiding the line number.

Comments

Popular posts from this blog

Maximum Gap

[ITint5] Maximum Subarray for a Circular Array

[CC150] Chapter 8 Object-Oriented Design