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

Re: Interactive search on the command line?



Mikael Magnusson <mikachu@xxxxxxxxx> writes:

> On Thu, Nov 26, 2015 at 9:04 AM, Dominik Vogt <vogt@xxxxxxxxxxxxxxxxxx> wrote:
>> 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.
>
> You can use ctrl-r for this. (eg, history-incremental-*-search-*).
>
> Another useful trick on long command lines is to type alt-300 or some
> suitably large number before pressing left/right.

I use this, and then ESC-Up/ESC-Down:

# Move by physical lines, like gj/gk in vim
# 09apr2013  +chris+
_physical_up_line()   { zle backward-char -n $COLUMNS }
_physical_down_line() { zle forward-char  -n $COLUMNS }
zle -N physical-up-line _physical_up_line
zle -N physical-down-line _physical_down_line
bindkey "\e\e[A" physical-up-line
bindkey "\e\e[B" physical-down-line

-- 
Christian Neukirchen  <chneukirchen@xxxxxxxxx>  http://chneukirchen.org



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