tmux的复制粘贴

tmux有面板的概念,这致使普通终端下的ctrl+shift+C的模式复制出来的文本会串行。若是面板只有一列固然没有问题,但当面板有多列时,复制就会出问题。因而tmux提出了相似vim的复制模式。所以,tmux下有两套复制方法。 按下shift的同时,使用ctrl+shift+c、ctrl+shift+v能够用之前的方式进行复制粘贴。这种方式的好处就是能够复制到操做系统的粘贴板中。 下面重点介绍tmux在vim模式下的复制粘贴。vim

~/.tmux.confui

set-window-option -g mode-keys vi #能够设置为vi或emacs
set-window-option -g utf8 on #开启窗口的UTF-8支持

tmux复制模式下可用的命令:操作系统

Function                 vi             emacs
Back to indentation      ^              M-m
Clear selection          Escape         C-g
Copy selection           Enter          M-w
Cursor down              j              Down
Cursor left              h              Left
Cursor right             l              Right
Cursor to bottom line    L
Cursor to middle line    M              M-r
Cursor to top line       H              M-R
Cursor up                k              Up
Delete entire line       d              C-u
Delete to end of line    D              C-k
End of line              $              C-e
Goto line                :              g
Half page down           C-d            M-Down
Half page up             C-u            M-Up
Next page                C-f            Page down
Next word                w              M-f
Paste buffer             p              C-y
Previous page            C-b            Page up
Previous word            b              M-b
Quit mode                q              Escape
Scroll down              C-Down or J    C-Down
Scroll up                C-Up or K      C-Up
Search again             n              n
Search backward          ?              C-r
Search forward           /              C-s
Start of line            0              C-a
Start selection          Space          C-Space
Transpose chars                         C-t

复制模式步骤: 一、C-b [ 进入复制模式 二、参考上表移动鼠标到要复制的区域,移动鼠标时可用vim的搜索功能"/","?" 三、安空格键开始选择复制区域 四、选择完成后安enter键退出 五、C-b ] 粘贴code