Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I tried, for a week, got very frustrated and switched back.

The little itch that drove me crazy was command-line editing: in bash (and all readline apps) when I have

   command long/path/to/some/file
I can press Alt-Backspace to delete 'file', or I can press Ctrl-W to delete 'long/path/to/some/file'.

I tried various hacks to make zsh do the same, then gave up.



    bindkey '^[^?' backward-kill-word 
might do the trick? (possibly '^[^h' depending on what your backspace key sends. Ctrl-v <backspace> should give you something you can copy)


This makes Alt-Backspace do the same thing as Ctrl-W, which is delete-everything-until-the-next-space. I'm missing the delete-last-segment-of-the-path function.

Edit: I know I can customize the word style using $WORDCHARS, or 'autoload select-word-style'; my problem is that I'm used to having the capability to use two different word styles at once.

I'm looking through the command list in zshzle(1), and I'm a bit confused about the differences between backward-delete-word and backward-kill-word. Some short experiments I did failed to notice any differences (foo/bar/baz M-x backward-delete-word deletes foo/bar/baz). There's also vi-backward-kill-word which deletes 'baz', then '/', then 'bar', then '/', then 'foo'. I want a key to delete 'baz', then 'bar/', then 'foo', and I've no idea how to get it...


Hrmm. It works as you want for me, but there may be some other config item I've set.

The other alternative is to try:

    autoload -U select-word-type
    select-word-type bash
which should override C-w to do what you want. I haven't looked at it enough to see if you can get both behaviours simultaneously though (and it requires a fairly recent zsh iirc)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: