I want to ask about vim+ tmux. I open two file with vim in two tmux pane. How can I copy code from vim in first pane to second pane. I used mode copy of tmux, but It had a number line and created a new line. Thanks for your help!
If the question is How to copy text from one vim window (in one tmux pane) to another vim window (in another tmux pane) then It's a matter of
In that case, on your terminal type
vim --version | grep clipboard then if output has something like this
+clipboard +job +path_extra +user_commands +eval +mouse_dec +statusline +xterm_clipboard
+clipboard means, your vim has clipboard capabilities.
And you can simply copy code by doing this,
- Visually select the text you need to copy.
- On your keyboard type
"+yyto "yank" text.
By using numbers you can say
Or you can say
"+yyto yank the current line.
After you have copied text from one vim window, you can then navigate to the second one and go to INSERT mode then type
Ctrl r + Control + r + plus sign which pastes text from vim
:REG Type that and see everything stored in them which you can actually replace the
plus sign in that code.
If however you have something like
-clipboard this means you don't have clipboard capabilities in your vim.
Easiest way is to install
vim-nox which has lots of capabilities including clipboard. Or install
gvim which will add your terminal vim those capabilities.
While pasting it's important to
:set paste before pasting and then
:set nopaste after pasting to reserve some formatting from the clipboard text into vim.
Regarding copying with tmux
Well, tmux will treat the whole of your vim as a board and it will just copy everything even the status bar the correct way to copy stuffs from vim is using vim's clipboard capabilities and the correct way to copy stuffs from your terminal is using
tmux & xclip.