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

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

On Sat, 25 Feb 2012, Phil Pennock wrote:

> 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.

Same thing, if you've not yet bound the key, can be done by 'fc' command.

Even more: if I notice I'll use the same things a few times soon,
I often do 'fc -# -1' (with '#' some *number* of lines back)
putting the last '#' number of lines into the editor at once.

Then e.g. put an 'doit() {' as first line, '}' as last, and edit the
repeated lines into something with '${1}' instead of the 'part to edit'.
Writing it back makes it into function 'doit' and I'll need not worry
about editing the right thing, just give the new as parameter.
The complete function will stay 'in one line of history', so I can even
repeat editing, if need be, or can be re-edited with 'zed -f doit'.


Christoph von Stuckrad      * * |nickname |Mail <stucki@xxxxxxxxxxxxxxx> \
Freie Universitaet Berlin   |/_*|'stucki' |Tel(Mo.,Mi.):+49 30 838-75 459|
Mathematik & Informatik EDV |\ *|if online|  (Di,Do,Fr):+49 30 77 39 6600|
Takustr. 9 / 14195 Berlin   * * |on IRCnet|Fax(home):   +49 30 77 39 6601/

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