tmux - 从 Midnight Commander、emacs 中窃取 Alt 键

Mad*_*ent 3 bind mc alt tmux

刚刚开始使用 tmux。到目前为止我真的很喜欢它——它是屏幕的可靠替代品。我遇到的一个问题是 tmux 窃取了其中运行的 Midnight Commander 的 Alt(元)按键。

\n\n

我已经将前缀键设置为 C-[,效果很好。但在使用 Midnight Commander 时,tmux 也将 Alt + anykey 解释为与 C-[ + anykey 相同。由于 MC 中有很多 Alt+ 按键,这变得非常烦人。

\n\n

因此,我要么需要让 tmux 忽略其中运行的所有应用程序的 Alt + 按键(例如,Midnight Commander、emacs 等)。

\n\n

我的 .tmux.conf 文件如下所示。任何帮助将不胜感激。

\n\n

谢谢,\n玛德琳。

\n\n
\n\n
# Turn on the status bar and change the coloring to my preference.\n# It is handy to highlight in red the active window.\nset -g status on\nset -g status-bg black\nset -g status-fg white\nset -g status-left \xe2\x80\x98#[fg=green]#H\xe2\x80\x99\nset-window-option -g window-status-current-bg red\n\n# Use emacs keys\nset -g status-keys emacs\n\n# Makes the prefix key immediately available. There\n#  is no pause necessary for an escape sequence\nset -s escape-time 0\n\n# Make our prefix key:  [\nunbind C-b\nset -g prefix C-[\n\n# Split windows using emacs keys\nunbind %\nbind 2 split-window -v\nbind 3 split-window -h\n\n# Allow a mouse click to switch panes\nset-option -g mouse-select-pane on\n\n# Set up a key to switch to the last active window\nbind-key C-l last-window\n
Run Code Online (Sandbox Code Playgroud)\n

che*_*ner 5

问题是Ctrl[Alt是向终端发送完全相同的字符(ASCII 33、ESC)的两种不同方式。终端无法知道哪个物理键生成了该字符。由于tmux位于终端和 Midnight Commander 之间,因此它总是会首先看到 ESC 并消耗它。我认为你唯一的选择是在 中使用不同的前缀tmux