zsh-workers
 help / color / mirror / Atom feed
* emacs-forward-word not emacs-like
@ 2020-10-21  3:28 Nathan Phillip Brink
  2020-10-21  3:35 ` Lawrence Velázquez
  2020-10-21 20:29 ` Bart Schaefer
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Phillip Brink @ 2020-10-21  3:28 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]

Hi,

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
text:

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!

-- 
binki

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-forward-word not emacs-like
  2020-10-21  3:28 emacs-forward-word not emacs-like Nathan Phillip Brink
@ 2020-10-21  3:35 ` Lawrence Velázquez
  2020-10-21 20:29 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Lawrence Velázquez @ 2020-10-21  3:35 UTC (permalink / raw)
  To: Nathan Phillip Brink; +Cc: zsh-workers

> On Oct 20, 2020, at 11:28 PM, Nathan Phillip Brink <ohnobinki@ohnopublishing.net> wrote:
> 
> 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?

Take a look at the WORDCHARS shell variable and try removing any
characters that don't strike your fancy.

vq

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-forward-word not emacs-like
  2020-10-21  3:28 emacs-forward-word not emacs-like Nathan Phillip Brink
  2020-10-21  3:35 ` Lawrence Velázquez
@ 2020-10-21 20:29 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2020-10-21 20:29 UTC (permalink / raw)
  To: Nathan Phillip Brink; +Cc: zsh-workers

On Tue, Oct 20, 2020 at 8:28 PM Nathan Phillip Brink
<ohnobinki@ohnopublishing.net> wrote:
>
> 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. [...]
>
> 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’.

In addition to Lawrence's reference to WORDCHARS, please note that Zsh
generally emulates Gosling Emacs, whereas Bash is patterned more after
GNU Emacs.  (I await Chet Ramey's correction of any inaccuracy in the
latter assertion.)  The zsh bindings are also somewhat entangled with
the "stty" definitions of word motion, so that people moving to zsh
from the default terminal driver will not be surprised (although
that's a disappearing minority nowadays).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-21 20:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21  3:28 emacs-forward-word not emacs-like Nathan Phillip Brink
2020-10-21  3:35 ` Lawrence Velázquez
2020-10-21 20:29 ` Bart Schaefer

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git