I have this problem with tmux 1.8: I want to set status-keys
option to 'emacs' because I really dislike entering commands in vi-mode. However adding the following line to .tmux.conf has no effect:
set -g status-keys emacs
When tmux is restarted, tmux show-options -g | grep keys
says emacs
but the actual behaviour is vi-style.
The root of the problem is the $EDITOR
environment variable, which it set to vim
in my case. The documentations states:
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'.
So apparently when the environment variable is "vim" it forces vi status-keys.
Is there a way to override this behaviour and have the prompt behave emacs-style despite the environment variable? I can obviously hack around this (like starting tmux with other env variables and restoring the original later) but I hope there is a clean solution.
Thanks!
I had this problem and I think I just figured it out. Are you by chance also using ZSH (Z Shell)?
I found this post that says that ZSH will also switch to "vi mode" if your VISUAL and/or EDITOR is set to vi/vim. So the problem I was having in tmux as actually bubbling up from ZSH!
In short, make sure you can use emacs-style keys in your shell outside of tmux. If you're using ZSH you can add bindkey -e
to .zshrc
to set emacs bindings. Then in .tmux.conf
:
set -g mode-keys emacs
set -g status-keys emacs
Both status-key
and mode-keys
default to vi
if EDITOR contains vi
, but this is only a default (during startup, before the configuration files are processed). Setting either of these options in your configuration should override the EDITOR-based default.
Are you also setting mode-keys
(which controls the key maps used in copy-mode
, and the choose-…
commands)?
set -gw mode-keys emacs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With