tmux 键盘快捷键无法正常工作

tmux 键盘快捷键无法正常工作

我最近开始使用 tmux,并更改了绑定,以便它响应 Ca 而不是 Cb。这些是 .tmux.conf 文件中用于执行此操作的行:

unbind C-b
set -g prefix C-a

但是,我无法使用 Ca 转到行首。Ca, Ca 不起作用,Ca,a 也不起作用。此外,其他快捷键(如 Ca, < 某个箭头键 > 在窗格之间移动)也不起作用。我遗漏了什么?

谢谢!

答案1

您已经完成了一部分。unbind C-b禁用默认前缀,并将set -g prefix C-aCa 设置为新的命令前缀,如 screen。要获取其他 screen 行为,请添加几行:

set -g prefix C-a
unbind C-b

# C-a a should send ctrl-a to the underlying shell (move to start of line)
bind-key a send-prefix    

# C-a C-a
bind-key C-a last-window

答案2

Ca,Ca 不会起作用,原因很明显。Man 将这些显示为默认键绑定:

 The default command key bindings are:

       C-b         Send the prefix key (C-b) through to the application.
       C-o         Rotate the panes in the current window forwards.
       C-z         Suspend the tmux client.
       !           Break the current pane out of the window.
       "           Split the current pane into two, top and bottom.
       #           List all paste buffers.
       $           Rename the current session.
       %           Split the current pane into two, left and right.
       &           Kill the current window.
       '           Prompt for a window index to select.
       ,           Rename the current window.
       -           Delete the most recently copied buffer of text.
       .           Prompt for an index to move the current window.
       0 to 9      Select windows 0 to 9.
       :           Enter the tmux command prompt.
       ;           Move to the previously active pane.
       =           Choose which buffer to paste interactively from a list.
       ?           List all key bindings.
       D           Choose a client to detach.
       [           Enter copy mode to copy text or view the history.
       ]           Paste the most recently copied buffer of text.
       c           Create a new window.
       d           Detach the current client.
       f           Prompt to search for text in open windows.
       i           Display some information about the current window.
       l           Move to the previously selected window.
       n           Change to the next window.
       o           Select the next pane in the current window.
       p           Change to the previous window.
       q           Briefly display pane indexes.
       r           Force redraw of the attached client.
       s           Select a new session for the attached client interac‐
                   tively.
       L           Switch the attached client back to the last session.
       t           Show the time.
       w           Choose the current window interactively.
       x           Kill the current pane.
       {           Swap the current pane with the previous pane.
       }           Swap the current pane with the next pane.
       ~           Show previous messages from tmux, if any.
       Page Up     Enter copy mode and scroll one page up.
       Up, Down
       Left, Right
                   Change to the pane above, below, to the left, or to the
                   right of the current pane.
       M-1 to M-5  Arrange panes in one of the five preset layouts: even-
                   horizontal, even-vertical, main-horizontal, main-verti‐
                   cal, or tiled.
       M-n         Move to the next window with a bell or activity marker.
       M-o         Rotate the panes in the current window backwards.
       M-p         Move to the previous window with a bell or activity
                   marker.
       C-Up, C-Down
       C-Left, C-Right
                   Resize the current pane in steps of one cell.
       M-Up, M-Down
       M-Left, M-Right
                   Resize the current pane in steps of five cells.

 Key bindings may be changed with the bind-key and unbind-key commands.

我当前的按键绑定(我更改了一些)如下:http://pastie.org/3016561

我的 ~/.tmux.conf 在这里:http://pastie.org/3016564

相关内容