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

Re: Interactive search on the command line?



Dominik Vogt wrote on Thu, Nov 26, 2015 at 09:04:00 +0100:
> Is there a way to do an interactive search (or at least a
> non-interactive string search) in the command line editor?  I
> often have extremely long gcc command lines where I want to delete
> an option or do some editing in the middle of the command line,
> and moving the cursor to the interesting spot is quite tedious.

There is vi-find-next-char, which is bound by default to 'f' in vi or
'^X^F' in emacs.

Also, you could do:
    % () { gcc -Wall -std=c99 "$@" foo.c } -my-argument-here
and edit the last word.

Also, there is the ^foo^bar history expansion with replacement:

    % echo foo
    foo
    % ^foo^bar
    echo bar
    bar

Daniel



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