macos 将前缀重新映射到 CTRL+A 后如何转到 tmux 中的行首?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9684115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:57:46  来源:igfitidea点击:

Howto go to beginning of line in tmux after remapping prefix to CTRL+A?

macosterminaltmux

提问by MetalElf0

following the suggestion in this Archlinux wiki, in the page about tmuxI remapped the command key prefix to C-a, to mimic GNU screen and to have something easier on the keyboard than C-b. So my .tmux.conf became this:

按照这个 Archlinux wiki 中的建议,在关于 tmux页面中,我将命令键前缀重新映射到C-a,以模仿 GNU 屏幕并在键盘上使用比C-b. 所以我的 .tmux.conf 变成了这个:

set -g default-terminal "screen-256color"
unbind C-b
set -g prefix C-a
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

However, while in screen it was possible to use C-a ato jump to the beginning of line, this does not work any more in tmux. As a sidenote, I'm using iTerm2 without the tmux integration.

然而,虽然在 screen 中可以使用C-a a跳转到行首,但这在 tmux 中不再起作用。作为旁注,我使用的是没有 tmux 集成的 iTerm2。

Does anybody know how to solve this?

有谁知道如何解决这个问题?

Thanks!

谢谢!

回答by Chris Johnsen

You need to tell tmuxthat Prefix+ashould send the prefix key to the program running in the current pane:

您需要告诉tmuxPrefix+a应该将前缀键发送到当前窗格中运行的程序:

bind a send-prefix