Question

I recently switch from bash to zsh shell. To be more precise, the oh-my-zsh Very nice, but the shortcut I most often use; jumping to the beginning/end of the line doesn't work anymore. From the docs it should be

ctrl + A --> beginning
ctrl + E --> end

However, when I do that I get the following

$~> my-command
$~> my-command^A   # did a ctrl + A here

Although I see this working by everybody else, on my system something seems to be different. Any suggestions what that might be ?

Was it helpful?

Solution 2

you don't have to config the Ctrl+A behavior if you use default keymap (emacs keymap). It does what you are expecting.

However if you set your zle to use vi keymap, you have to define the keybind for vi-beginning-of-line. same for Ctrl+E.

So check which keymap did you set in config. If it was vi, try pressing ESC then ^ and $ should do what you want.

OTHER TIPS

If you're wondering why this happened: You likely have $EDITOR or $VISUAL set to vi/vim which made zsh default to the vi keymap which doesn't use ctrl+a for moving the caret.

Adding bindkey -e to ~/.zshrc will restore the old behavior (emacs keymap).

zsh .zshrc

bindkey "^A" vi-beginning-of-line
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top