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

Re: backward-kill-shell-word widget



Sebastian Gniazdowski wrote on Sun, Jan 10, 2016 at 14:37:26 +0100:
> I see that you use (z) flag :) I think this is cool. I just was about
> to decide to bind shell-worded transpose-words-match to Alt-r (have
> transpose-segment bound to Alt-t) and noticed that I rather want to
> keep select-word-style bash. I rather want Ctrl-W to delete normal
> words. So with your function one can have:
> - "Ctrl-W" / backward-kill-word to delete word with style of his choice
> - transpose-words-match to swap words with style of his choice,
> keeping in mind to position cursor at beginning of the words
> - "Alt-m" / copy-prev-shell-word to copy shell word regardless of word style
> - "Ctrl-T" / backward-kill-shell-word to delete shell word regardless
> of word style
> - "Alt-t" / my transpose-segment to swap shell words regardless of
> word style (should I rename the widget to "transpose-shell-word",
> looks like yes)
> - "Alt-/" / _history-complete-older to complete shell words regardless
> of word style
> 
> I think this goes into a nice workbench for quick manipulation of
> command line, if one devotes time to establish order in that set of
> loosely coupled functionalities.

Don't put too much weight on my choice of <C-T> for b-k-s-word.  It's
not my preferred choice for b-k-s-word, it's simply the chord I always
use for testing widgets.

As to the general issue, I'd consider some more systematic approach.  Vi
has its operators; you could have something similar by having a "prefix
key" that chooses the word style: e.g., <C-T><w> or <C-T><C-W> would
"delete a shell word backwards", <C-Y><w> or <C-Y><C-W> would "delete
a whitespace-separated word backwards", and plain <C-W> would delete
a default-styled word backwards.

And of course a NUMERIC could be prepended to any of those, just as with
vi operators.

How does emacs handle this issue?  Does emacs have different chords for
different kinds of "delete a word backwards"?



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