Search code examples
linuxvitmux

How to copy text from one vi file to another vi file while using tmux


I am using tmux on a Linux server, and I am in two distinct directories on both tmux panes.

I have foo.txt open in pane 1, and bar.txt open in pane 2.

I want to copy text from pane 1 and move it to pane 2.

These were my steps:

  1. Be in pane 1 (control+B, 0).
  2. vi foo.txt
  3. selecting text in VISUAL MODE followed by "+y in foo.txt (get the mesage "10 lines yanked")
  4. Switching to pane 2 (control+B, 1)
  5. vi bar.txt
  6. and then hitting p when the file opened up in my terminal.

However, that did not work. How can I pull this off? I am using a Mac (keyboard) but the server is linux.


Solution

  • I had been dealt with this problem and wrote down a note on this here: https://github.com/g6ai/dotfiles/wiki/tmux.conf

    Here I assume you are ssh-ing into Linux from macOS. You could found my tmux.conf in the same dotfiles repo.