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

Re: backward kill

Jesper Holmberg wrote:
> Hi all,
> I am using the emacs key bindings. If I've written the following:
> /path/to/some/file
> with the prompt at the end, and I press alt-backspace, the whole path
> is wiped out. I would like it to just remove backwards to the last
> (first from the end) slash. How could I accomplish this?

i use this bit contributed by someone on the list (Oliver Kiddle); check
the archives from Mon, Oct. 8 for more info on this:

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

i have it bound to control-W with:
bindkey '^W' tcsh-backward-delete-word

but you can change that obviously.

i think that's what you're looking for, no?

the '$WORDCHARS' variable is how zsh determines word boundaries so you
could add '/' to that globally, however this might affect other things
you want to leave it for, so i prefer this function.


GPG Public Key:

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