5
+-------------+
|             |
|     1       |
|             |
|=============|
|             |
|     2       |
|             |
+-------------+

Each tmux split has vim open. I would like to do stuff like yank a line from 1 and paste then into 2 with the vim shortcuts.

  • 1
    Sounds interesting - but can you describe what exactly you want to do? Which programms to run, what to share exactly? (Buffer could mean several things here) – Volker Siegel Apr 15 '15 at 22:31
  • In vim, there are buffers, but that seems not to be what you talk about (see :help buffers in vim). Also, tmux uses the term "buffer" for paste bufferes - if you want to do something with a tmux buffer involving vim, what you do is all in tmux, working on the output of vim (in a pane or maybe buffer) – Volker Siegel Apr 16 '15 at 3:27
  • Ya sorry my language in regards to this kind of stuff is really weak.... as i am self taught and tend to learn based on my needs and nothing more. I will try and clarify... – Derek Adair Apr 16 '15 at 18:26
  • So I was right, it's interesting indeed! – Volker Siegel Apr 16 '15 at 20:47
  • If you're using an X-unaware vim it's going to be a challenge; gvim can use GTK's clipboard to yank between instances, but the console version doesn't have a good way for instances to talk to each other (or indeed to any external program). However, assuming you have a clipboard-enabled build and are just using it in console mode, you can set clipboard=unnamedplus which uses the X primary selection as the backend for yank. – Bandrami Apr 17 '15 at 4:58
2

The two vim instances are completely separate from each-other, but there are two possibilities to do this.

  1. If your version of vim was compiled with X clipboard support you can use eg. "+yy to yank the current line to the X clipboard register, alternatively putting set clipboard=unnamed in your vimrc to yank to the clipboard by default. See :help registers for some information on vim registers.

  2. vim has built in support for split windows, so another option is to use the built in splits instead of using tmux window splitting. See :help windows or this linux.com article for more information about them.

To check for X clipboard support you can run vim --version and see if there’s a plus before xterm_clipboard in the output. If there’s a minus instead it means that your vim was built without X clipboard support and you’ll either have to get a copy with it, or use the second solution.

  • I try to do #2, but sometimes my workflow takes in in a direction that ends up in the state that I've described. I'll check out how i might leverage #1. – Derek Adair Apr 17 '15 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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