Score:2

Copy and paste in in Tmux and Vim: have we reach a consensus?

ru flag

I am trying to use Tmux and Vim for better efficiency. Unfortunately, there is a copy/paste issue, as it is not possible to use the Vim visual mode between two panes of Tmux.

Several methods have been discussed in this 9-years-old post, but they are tedious: How to paste text from Vim editor to browser?

I was wondering if a consensus has been reached nowadays on the best method to use?

Bodo avatar
pt flag
Asking for *the best method* will result in opinion-based answers. If you need a solution for a problem you can of course ask for a solution and then choose the best answer from your point of view. Does any answer to the referenced question solve your problem? If yes, then we don't know which would be the best method for you. If not, then please [edit] your question and add more details about your problem why "*it is not possible to use the Vim visual mode between two panes of Tmux*" and why the existing answers don't fit in your case.
mattb avatar
in flag
There is the vim-slime plugin which allows you to 'send' selected text from vim directly to a tmux (or screen) pane: https://github.com/jpalardy/vim-slime
Score:2
cn flag

I'm assuming that you want to copy-paste between 2 vim processes running in 2 different tmux panes.
You can do this by adding the following to your ~/.vimrc:

" Enable copying from vim to the system-clipboard
set clipboard=unnamedplus  

Now you copy in 1 vim process, navigate to your other vim process using tmux, and paste.

This also works if vim is running in another tmux window. Or if you want to paste from vim to another process (e.g. your browser).

For more information you can run: :help 'clipboard' inside vim.

Drosera_capensis avatar
ru flag
Thank you melvio, it works pretty well from one VIM pane to another! However, it seems that it doesn't work out of VIM. It is not possible to paste the text to a terminal or a browser. Do you have a specific method to do it?
Drosera_capensis avatar
ru flag
My apologizes, the content yanked can be pasted with a simple Ctrl+V. Thanks a lot melvio!
Dmitry avatar
gg flag
This not gonna work on virtual machine without desktop environment accessed by ssh
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.