2

I've been tinkering with my dotfiles lately, and at some point I lost use of the default ^A and ^K keymappings, which I use frequently.

bindkey -L | grep '\^[AK] 
# bindkey -R "^A"-"^C" self-insert
# bindkey "^K" self-insert

But the man page for zshzle clearly states that ^K and ^A are mapped by default to kill-line and asf, as I've come to expect.

I can't find anywhere in any of my initialization files where this would have been remapped! I certainly didn't do it:

print /usr/local/ ~/.z^(compdump|sh_history) ~/dotfiles | xargs ag 'bindkey'
# /Users/vercingetorix/.zshrc
# 56:bindkey "^[[3~" delete-char
# 
# /Users/vercingetorix/dotfiles/zsh/zshrc
# 56:bindkey "^[[3~" delete-char

That's all I have!

In fact I know I didn't do it:

zsh -x &> diagnose.log
exit
wc -l diagnose.log
#     3802 diagnose.log
[[ -z $(ag '\^[AK]' diagnose.log) ]] && print 'nothing!'
# nothing!
[[ -z $(ag 'bindkey -[evaM]' diagnose.log) ]] && print 'nothing!'
# nothing!

So what gives? What's happening to the default mappings?

1 Answer 1

4

I figured it out!

From the zshzle man page:

In addition to these names, either 'emacs' or 'viins' is also linked to the name 'main'. If one of the VISUAL or EDITOR environment variables contain the string 'vi' when the shell starts up then it will be 'viins', otherwise it will be 'emacs'. bindkey's -e and -v options provide a convenient way to override this default choice.

Lo and behold, I had recently set EDITOR and VISUAL to "vim". Removing this setting gives me back my key bindings (I guess these are Emacs defaults, but they're also familiar Mac bindings).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .