So let's say I have two splits open in byobu, side by side. Furthermore, both splits have different files open in vim. I want to highlight text from one file in one split and copy it to a separate file in the other split. Any ideas?
All the results I found while searching for this talked about using the scrollback feature to copy and paste in byobu, however, that only seems to work inside a single split; not across splits.
Looks like I posted to quickly; seemed to have found the solution. I followed the steps found here:
http://linuxcommand.org/lc3_adv_termmux.php
I followed the steps:
shift-f3
- move to split to be copied from
alt-pgup
- enter copy mode
space
- start selection
cursor through desired text
enter
- end selection
shift-f3
- shift focus to split to copy to
ensure receiving vim is in insert mode
alt-insert
- paste selected text
If you are using an X Window Server, an alternative mouse-based solution to using the scrollback mode (which involves remembering a lot of keystrokes) is:
- Zoom in on the current pane (Shift-F11), bringing this pane to the foreground.
- You can now select the relevant text with your mouse without the vertical split getting in the way.
- Unzoom the pane (Shift-F11 again)
- Switch to other pane or wherever else you want to paste.
- Middle click paste.
If your Vim supports the system clipboard (i.e. if vim --version
output shows +clipboard
), you can copy into the system clipboard from the first Vim and paste from it into the second one. This releaves us of the need to ensure the receiving Vim is in insert mode and has paste
set appropriately.
The trick is to use the "+
register. So when you do the copy, prefix whatever yanking command you want to use with "+
; and do likewise prefix the put command you use in the receiving Vim with it.
If you're on an X11 system, you can also use the "*
register, which is X's "PRIMARY" selection buffer -- the one where text goes if you just highlight it, and which you can paste by pressing the middle button.
See :help gui-selections
. GUI selection support generally requires a Vim other than "vim-tiny"; on Debian and Ubuntu the vim-gtk and vim-gnome packages are good choices.
来源:https://stackoverflow.com/questions/25923952/how-to-copy-from-one-split-and-paste-in-another-in-byobu