- Last update:

Copy Pasting In Tmux And Vim

How to copy and paste with Tmux and Vim

🕒 3 min read

Category: Linux

Tags: tmux, vi, vim, linux, terminal

Over the last couple of years, I've spent quite a lot of time fine-tuning my prompt. Most of my configuration is available online, so feel free to use it.

My configuration is as follows:

For example, this is my current terminal (actually containing 3 terminals):


(the top-right terminal is of no use, I just opened it to show how clever zsh coupled with Prezto is).

The problem

I guess most beginners with Tmux and Vim (especially Vim) stumble upon one problem (and the number of questions on StackOverflow asserts it): how to properly copy-paste? I had that problem too. I'll answer to these questions simply.

First of all, you have to know that, on X11 systems (which means most GNU/Llinux distros), there are two "clipboards":

Secondly, you may know that, in most programs you can use:

Let us now see how to copy paste from one environment to another one.


Copy-pasting from Vim to Vim (same instance)

Copying from Tmux

Use my conf file and install xclip (sudo apt-get install xclip) to achieve the following:

Copying from Vim

Pasting in Tmux

Pasting in Vim

Hope this was helpful.