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

!$ changes when mistyped?



Apparently there's something different enough about my work keyboard such that I constantly inadvertently type !4 when trying to type !$. (I reaally oughtta bind !$ to a key, considering how frequently I use it.)

The problem, though, is that I often then hit <Tab>, so that I can modify whatever !$ was. When I accidentally type !4<Tab>, it expands to 'vi .zsh_prompt-'. But, if I catch my mistake and type C-/ (which produces the equivalent of "^_", bound to undo), then delete the '4' and replace it with '$', <Tab> expands '!$' to '.zsh_prompt-'. (the last word of command 4 instead of the last word of the previous command.)

Is this behavior expected -- should history expansion/completion (terminology?) change what '!$' references? If so, is it configurable?

FWIW, my workaround has been to (when I typo, which is frequently):

!4<Tab>
<C-/><Backspace>!$
(ending up with !!$, instead of !$).

--
Best,
Ben



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