When you’re using macOS with bash, you can use the Home and End keys on your keyboard to jump to the beginning or end of the line you’re on.
But Apple switched from bash to Zsh with Catalina, and I noticed those keys don’t work anymore.
The Fix
Edit ~/.zshrc
with your favorite editor, for example, nano.
Add the following two lines, save and exit:
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
Now close and reopen your terminal.
Alternatively, you can run this command as “one-liner”:
echo 'bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line' >> ~/.zshrc
If this “one-liner” (really, it’s two lines) does not work for you, try the manual step above.
Again, remember to close and reopen your terminal so that it will load the new settings!
That’s all there is to it!
PS I run this blog on my free time, if I helped you out, consider donating a coffee!
Awesome. Thank you!