MacOS – How to get fn + left key working on macOS after changing to zsh from bash

bashitermmacoszsh

In case it is not clear fn + left key is simply the HOME button. It takes you to beginning of line. This seems to still work when editing a file (in vim) say so I think zsh does something with the bindings. fn + left now results in an "error" sound.

UPDATE:

posting this link here as it seems where to go for this kind of general stuff: What are the practical differences between Bash and Zsh?

Changing from bash to zsh costs everyone a lot of time and money. Apple has decided to push this on everyone for various reasons. There should be good defaults for everything. Home keys should work, PS1 should be reasonable. Old .bashrc and .profile translations should be automatically generated. Not doing this is stealing from users. We are bailing them out for their "bad" decision to use bash or equivalents bash's decision to change license.

How to make everything "just work" like for bash?

I use iTerm 2 like a normal person. Not sure if that is related.

Best Answer

To get fn-left (Home) and fn-right (End) working, add these two lines to ~/.zshrc (for your user only), or /etc/zshrc (for everybody)

bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line