I'm running Vim 7.3 under Linux Mint 13 (using MATE) and I'm not able to save text to the system clipboard. I run Vim in the terminal and copy text from the terminal with CTRLINSERT. When I select text in Vim (either with the mouse or in visual mode), CTRLINSERT doesn't copy any text. In addition when I right-click, Copy is grayed out. Further, I can't write to the system buffer by yanking to the corresponding register using vim commands. However, I'm able to paste while in insert mode (using SHIFTINSERT or right-click paste). I'm also able to copy text directly from the terminal using the same technique, just not text from Vim.

Here is my current ~/.vimrc. The relevant part is most likely set clipboard=autoselect,unnamed,exclude:cons\|linux. If I put finish at the top of my ~/.vimrc, I have the same issue, so I think the line is wrong, but I've tried set clipboard=unnamed and had the same behavior.

Could there be another config file affecting Vim's behavior? How can I change my ~/.vimrc to allow me to copy text from Vim?

migrated from serverfault.com Jun 14 '12 at 16:29

This question came from our site for system and network administrators.


I believe your copy problem is caused by:


in your .vimrc This sets your vim into visual mode whenever you select something with the mouse. And for some mad reason one is not allowed to copy when in visual mode. You can get around it by holding down shift when selecting text not to go into visual mode allowing you to use the copy menu.

or you could change to:

:set mouse=v

and copy will work again. add it to your ~/.vimrc file if you want it to be permanent

  • 2
    While this might actually solve their problem an explanation of why it works would be more useful. Without it your answer is just telling someone to Press the Green Button Twice - It might work, it might not, but it doesn't enlighten them. – voretaq7 Jun 11 '12 at 16:06
  • Thanks, that solved it. The explanation you added after voretaq7's comment helped a lot, too! – maksim Jun 11 '12 at 20:49
  • This works for Cygwin, too. – Dave Jarvis Nov 21 '12 at 0:22
  • 1
    This mode will highlight everything, so if I want to copy a few lines, I'm also copying line numbers and all the empty space after each line until the end of the screen. Is there a way to only have it select the relevant content (which is how highlight works when mouse=a)? – Dennis Mar 12 '14 at 18:08
  • Good answer. Just a plus: more mouse modes here :help mouse – Dr Beco Aug 25 '14 at 21:42

sudo apt-get install vim-gtk will likely solve this problem for other Googlers.

Good ol' terminal-style vim doesn't have access to the clipboard, which is a part of the X windows system. Installing vim-gtk gives vim the access that it needs to modify and view the clipboard.


The terminal doesn't know anything about vim selections, so don't expect it to be any help. You will need vim to be built against X (e.g. gvim -v), and then yank to and put from the + register.

  • 1
    The vim-gtk package in Ubuntu contains clipboard support (even when executed as vim in a terminal). – mgorven Jun 11 '12 at 4:15

just gvim on arch linux if anyone wants to know. Also, have a look at neovim (and python-neovim && python2-neovim for You Complete Me support, etc).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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