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

Bang-four (Re: "{ } always { }" construct and return in called functions)



On May 26,  7:20pm, Dave Yost wrote:
} 
} By accident I often type !4 and then tab 
} instead of !$ and then tab.
} When I backspace over the !4 and type !$, the !$ seems to be invisible, i.e. doesn't work.

This happens because when !4 is expanded, it sets the current history event
to 4.  Then when you expand !$, it tries to grab the last word of event #4.
If your shell has been running long enough that event #4 has fallen out of
the history, there is no last word of that event to expand.

This has always bothered me a bit -- it sort of makes sense that when you
type out a command line containing !4 !$ and hit enter, you get the same
history event for both references, but when expanding one at a time with
ZLE's expand-word that makes much less sense.  On the other hand if you
tab-expand the entire line at once, you do want the same behavior as if
you hit enter.

Anyway you can make all of this sane with "setopt CSH_JUNKIE_HISTORY".



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