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?

  • Dead link for the current vimrc. Commented Apr 8, 2022 at 15:37
  • Amplifying @questionto42standswithUkraine's comment: the efficacy of the question and answers is reduced significantly without seeing the vimrc contents
    – Rondo
    Commented Dec 1, 2022 at 3:34

8 Answers 8


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 :set mouse=v to your ~/.vimrc file if you want it to be permanent (create ~/.vimrc if it does not exist yet).

  • 4
    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
    Commented Jun 11, 2012 at 16:06
  • 1
    Thanks, that solved it. The explanation you added after voretaq7's comment helped a lot, too!
    – maksim
    Commented Jun 11, 2012 at 20:49
  • 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
    Commented Mar 12, 2014 at 18:08
  • 1
    After being frustrated by this for YEARS, you have saved me a lot of future misery!
    – hopeseekr
    Commented May 5, 2019 at 15:26
  • 1
    Thanks, solved my pain. What I don't understand is why Vim (8.1 for me) sets mouse=a as default? This is very frustrating.
    – ibic
    Commented Dec 30, 2019 at 11:36

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.

  • 3
    Works! On Debian Buster (now in testing) I installed vim-gtk and then my command line vim in xterm allowed me to use the * and + buffers to access the x window buffers. The vim-gtk installation uses the Debian alternatives to set vim -> /usr/bin/vim.gtk.
    – RobertL
    Commented Apr 9, 2019 at 17:52

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).

  • Try using gvim via ssh.
    – hopeseekr
    Commented May 5, 2019 at 15:26

Using Pop!_OS 21.04 and ran into this issue.

Per this github comment, installing xclip worked fixed this for me.

sudo apt install xclip


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.

  • 3
    The vim-gtk package in Ubuntu contains clipboard support (even when executed as vim in a terminal).
    – mgorven
    Commented Jun 11, 2012 at 4:15
  • Agreed and confirmed on Debian Buster (now in testing) I installed vim-gtk and then my command line vim in xterm allowed me to use the * and + buffers to access the x window buffers. The vim-gtk installation uses the Debian alternatives to set vim -> /usr/bin/vim.gtk.
    – RobertL
    Commented Apr 9, 2019 at 17:57

I use this plugin. Works even if you have -xterm_cliboardor -clipboard. The mapping is also very simple, just cp and cv for copy and paste.


On the question text at first:
I do not believe that you cannot select and copy with the mouse "what you see" in the window since I have the same issue like you, it seems, and I can do so, but I cannot mark more than the window and copy that, only then, Copy is grayed out. Well, we might have different problems here. Still, this tool trick should help as well:


You need a terminal program that embeds vim into the terminal text, for example the "Alacritty" terminal. With that, you can just zoom out and copy with Ctrl+Shift+C or your clipboard key.

You can also try the vim mode: press Ctrl+Shift+Space, you can then move through the console history and mark what you need, if you need all, type the vim command ggVG, afterwards, you can paste it in a text file and then back in terminal, you get out of the vim mode by pressing Ctrl+Shift+Space again.

Tmux + clipboard (in Alacritty or another terminal)

If you need to copy large text that you cannot copy with the zoom out trick of Alacritty, install tmux and a clipboard like xclip or xsel. Tmux is not a terminal on its own. Try its commands in Alacritty or any other terminal.

sudo apt-get update -y 
sudo apt-get install -y xclip

And put this in your ~/.tmux.conf to bind y to the xclip copy:

bind -T copy-mode-vi y send -X copy-pipe "xclip -selection c"

With the tmux shortcut Ctrl+B-->[ you can start marking whatever you want with Space and then Arrows or picture up/down. After you marked all of the needed text, press y that you bound to "copy to xclip". That makes it possible to copy anything, no matter what size.

See also How to copy multi-page text from the terminal into the clipboard?.


I was having the same trouble in nvim on macOS, and got it working by running this (no need to modify it, just press : then run as-is):

set mouse=

After that I could copy/paste from nvim in the terminal as expected.

I found this information here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .