在 tmux 中复制光标下的单词?
Copy word under cursor in tmux?
我认为这是常见操作,但找不到任何相关信息。在复制模式下时(Ctrl + [) 有没有快捷方式可以复制光标下的单词而不用手动创建选择?
我试过切换到 vi-mode 并使用 yw
但它看起来不起作用(事实上,我不完全确定 vi-mode 除了映射箭头之外还能做什么hjkl 键)。
知道如何实现吗?
编辑:正如@Sebastian Graf 所指出的,tmux
现在有一个本地命令:send-keys -X select-word
用于 select 一个词。接下来我留给子孙后代...
bind -n -T copy-mode-vi C-d send-keys b \; send -X begin-selection \; send-keys E
我使用上面的方法至少 select 光标下的当前单词。快捷方式是 C-d
,灵感来自 Sublime Text。您还需要设置 set-window-option -g mode-keys vi
,但我认为这是默认设置。在 vi 模式下,b
将光标移动到当前单词的开头,然后它开始 selecting begin-selection
,然后将光标移动到当前单词的结尾 E
.
所以你也可以复制这个词:
bind -n -T copy-mode-vi C-d send-keys b \; send -X begin-selection \; send-keys E \; send -x copy-selection.
我在此处包含了所有命令,因为我在 Internet 上找不到任何实际格式很好的地方。
Function Vi Emacs
-------------------------------------------
Back to indentation ^ M-m
Bottom of history G M-<
Clear selection Esc 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/Copy to end of line D C-k
End of line $ C-e
Go to line : g
Half page down C-d M-Down
Half page up C-u M-Up
Jump forward f f
Jump backward F F
Jump again ; ;
Jump again in reverse , ,
Next page C-f PgDown
Next space W
Next space, end of word E
Next word w
Next word end e M-f
Paste buffer p C-y
Previous page C-b PgUp
Previous word b M-b
Previous space B
Quit mode q Esc
Rectangle toggle v R
Scroll down C-Down/C-e C-Down
Scroll up C-Up/C-y C-Up
Search again n n
Search again in reverse N N
Search backward ? C-r
Search forward / C-s
Start of line 0 C-a
Start selection Space C-Space
Top of history g M->
Transpose chars C-t
我认为这是常见操作,但找不到任何相关信息。在复制模式下时(Ctrl + [) 有没有快捷方式可以复制光标下的单词而不用手动创建选择?
我试过切换到 vi-mode 并使用 yw
但它看起来不起作用(事实上,我不完全确定 vi-mode 除了映射箭头之外还能做什么hjkl 键)。
知道如何实现吗?
编辑:正如@Sebastian Graf 所指出的,tmux
现在有一个本地命令:send-keys -X select-word
用于 select 一个词。接下来我留给子孙后代...
bind -n -T copy-mode-vi C-d send-keys b \; send -X begin-selection \; send-keys E
我使用上面的方法至少 select 光标下的当前单词。快捷方式是 C-d
,灵感来自 Sublime Text。您还需要设置 set-window-option -g mode-keys vi
,但我认为这是默认设置。在 vi 模式下,b
将光标移动到当前单词的开头,然后它开始 selecting begin-selection
,然后将光标移动到当前单词的结尾 E
.
所以你也可以复制这个词:
bind -n -T copy-mode-vi C-d send-keys b \; send -X begin-selection \; send-keys E \; send -x copy-selection.
我在此处包含了所有命令,因为我在 Internet 上找不到任何实际格式很好的地方。
Function Vi Emacs
-------------------------------------------
Back to indentation ^ M-m
Bottom of history G M-<
Clear selection Esc 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/Copy to end of line D C-k
End of line $ C-e
Go to line : g
Half page down C-d M-Down
Half page up C-u M-Up
Jump forward f f
Jump backward F F
Jump again ; ;
Jump again in reverse , ,
Next page C-f PgDown
Next space W
Next space, end of word E
Next word w
Next word end e M-f
Paste buffer p C-y
Previous page C-b PgUp
Previous word b M-b
Previous space B
Quit mode q Esc
Rectangle toggle v R
Scroll down C-Down/C-e C-Down
Scroll up C-Up/C-y C-Up
Search again n n
Search again in reverse N N
Search backward ? C-r
Search forward / C-s
Start of line 0 C-a
Start selection Space C-Space
Top of history g M->
Transpose chars C-t