How to copy from one split and paste in another in byobu?

≯℡__Kan透↙ 提交于 2019-11-30 17:38:07

问题


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.


回答1:


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




回答2:


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:

  1. Zoom in on the current pane (Shift-F11), bringing this pane to the foreground.
  2. You can now select the relevant text with your mouse without the vertical split getting in the way.
  3. Unzoom the pane (Shift-F11 again)
  4. Switch to other pane or wherever else you want to paste.
  5. Middle click paste.



回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!