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

Re: New user questions



Friedrich Dominicus wrote:

> > Changing separators
> > -------------------
> >
> > All the editor commands define a word separator as a space.  Is there a
> > way of changing zsh's idea of word separators?  I would prefer that it
> > consider '/' to be a separator as well.
> 
> guess zsh makes this automatically. But don't know

Zsh's idea of word separators is defined by the WORDCHARS parameter. It
actually defines characters to be considered part of a word as opposed
to separators. You can remove slash from it:

WORDCHARS="${WORDCHARS:s@/@}"

Personally, I only want slash to be considered a word separator for
moving and deleting words backward and forward - not for other things
like copying the last word so I define my own functions for these which
all look something like this:

tcsh-backward-word() {
  local WORDCHARS="${WORDCHARS:s@/@}"
  zle backward-word
}

Then I can do:
zle -N tcsh-backward-word
bindkey "..." tcsh-backword-word

Oliver Kiddle



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