Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

emacs-forward-word not emacs-like


I was trying out zsh due to it being the default/recommended shell on
Mac OS X:

binki@Nathans-Air ~ % zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)

I checked the reslease notes for 5.8 and did not see anything
obviously related to my issue.

I was trying to write input to a line and move my cursor about using
M-f and M-b and deleting chunks at a time with M-d. I found that these
behave differently from Emacs and bash. When researching this, I came
across https://unix.stackexchange.com/a/106380 . However, the bindings
suggested there do not behave the same. Consider the following input

a-b-c d-e-f

If my cursor is positioned at ‘a’ and I press M-f, bash and Emacs
will move the cursor to point to the first dash ‘-’ (dash) (i.e., to
immediately after the ‘a’). zsh’s emacs-forward-word will instead
position the cursor immediately after ‘c’. M-b mapped to
emacs-backward-word and M-d mapped to kill-word suffer from the same
issue where dashes and other punctuation(?) are incorrectly considered
to be word characters.

Since I am so used to the behavior of Emacs and bash, this divergent
behavior of zsh for these keys is really disruptive.

Is there a way to get Emacs/bash-style cursor movement for these
bindings? Could an emacs-kill-word be added along with
emacs-emacs-forward-word and emacs-emacs-backward-word which actually
behave more like Emacs or something? Would such a patch be accepted?
Is thre a way to get this behavior with bindings to a script?

Please CC me on replies as I am not subscribed. Thanks!


Don’t forget to check for missing or extraneous apostrophes!

Attachment: signature.asc
Description: Digital signature

Messages sorted by: Reverse Date, Date, Thread, Author