
在 中tmux
,我通常想選擇整行進行複製。
如何按行選擇文本,如vi
命令V
?
答案1
這是解決方案,在複製模式下
1. move to the line you want to select
2. pres 0, then the cursor will move to the fist position of this line,
same as vim
3. enter whitespace (start copy)
4. type $. Then it will highlight the whole line.
答案2
命令tmux
是select-line
。
這是我使用的一組很好的映射(copy-mode
如果不使用則使用copy-mode-vi
):
# Selection / copy / paste
bind-key -T copy-mode-vi v send -X begin-selection # default is <space>
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi C-v send -X rectangle-toggle # default is C-v, or R in copy-mode (non-vi)
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -selection clipboard -in'
bind p paste-buffer # default ]