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

Re: s/pattern/pattern/g on the commandline ?



On 2012-02-25 at 19:46 +0100, Moritz Bunkus wrote:
> while we're at it: is there a way to do history expansion without
> actually submitting the modified entry? Meaning I would like to verify
> that my regex fu was strong enough to produce the correct command
> before submitting it. "!!:gs/what/ever" executes the command directly
> if I'm not mistaken.

setopt hist_verify

Note: if you *really* want to be able to edit your command-line with
something with the full power of a text editor, then sometimes there's
no substitute for a text-editor.

bindkey '^[v' edit-command-line

Then pressing esc-v will invoke $VISUAL (else $EDITOR, else vi) as a
text-editor for adjusting the current command-line.  So <up> and then
<esc>-v will let you do as much as you need.

Be careful to not suspect the text-editor, only save and exit when
you're done.



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