我在tmux1.8中遇到了这个问题:我想将status-keys选项设置为'emacs‘,因为我真的不喜欢在vi-mode中输入命令。但是,将以下行添加到.tmux.conf没有任何效果:
set -g status-keys emacs当tmux重启时,tmux show-options -g | grep keys会显示emacs,但实际的行为是vi样式的。
问题的根源是$EDITOR环境变量,在我的例子中,它设置为vim。文档中写道:
status-keys [vi | emacs]
Use vi or emacs-style key bindings in the status line,
for example at the command prompt. The default is emacs,
unless the VISUAL or EDITOR environment variables are set
and contain the string `vi'.显然,当环境变量为"vim“时,它会强制使用vi状态键。
有没有一种方法可以覆盖这个行为,并让提示行为具有emacs风格,而不考虑环境变量?我显然可以绕过这个问题(比如用其他环境变量启动tmux,然后恢复原来的环境变量),但我希望有一个干净的解决方案。
谢谢!
发布于 2016-09-16 05:06:54
我有这个问题,我想我已经弄明白了。您是否也在使用ZSH (Z Shell)?
如果你的视觉和/或编辑器设置为vi/ I found this post,ZSH也会切换到"vi模式“。所以我在tmux中遇到的问题实际上是从ZSH冒出来的!
简而言之,请确保可以在tmux之外的shell中使用emacs样式的密钥。如果你正在使用ZSH,你可以在.zshrc中添加bindkey -e来设置emacs绑定。然后在.tmux.conf中
set -g mode-keys emacs
set -g status-keys emacs发布于 2013-08-15 14:30:25
如果编辑器包含vi,则status-key和mode-keys都默认为vi,但这只是一个默认值(在启动期间,在处理配置文件之前)。在配置中设置这两个选项中的任何一个都应该覆盖基于编辑器的默认值。
您还在设置mode-keys (它控制在copy-mode中使用的键映射和choose-…命令)吗?
set -gw mode-keys emacshttps://stackoverflow.com/questions/18240683
复制相似问题