Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: History key bindings
- X-seq: zsh-users 1153
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Christopher Croughton <crough45@xxxxxx>, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: History key bindings
- Date: Thu, 27 Nov 1997 09:55:58 -0800
- In-reply-to: <97Nov26.191202gmt+0100.17029@xxxxxxxxxxxxxxxxx>
- References: <97Nov26.191202gmt+0100.17029@xxxxxxxxxxxxxxxxx>
On Nov 26, 6:10pm, Christopher Croughton wrote:
} Subject: History key bindings
}
} Is there some way to cause zsh to remember the buffer up to where it was
} when the search started and use that, while putting the cursor at the end
} still?
That shouldn't be terribly difficult to code as a zle module, if you have
3.1.2. The code for vi-repeat-search might be a good starting point.
However, this does a pretty good job:
bindkey '^X^P' history-beginning-search-backward
bindkey -s '^[[A' '^X^X^X^P^@^E'
That binds up-arrow to:
exchange-point-and-mark ^X^X
history-beginning-search-backward ^X^P
set-mark-command ^@
end-of-line ^E
When you first press up-arrow, there (normally) won't be any mark on
the line, so ^X^X does nothing. Then ^X^P finds the previous history
item with the prefix, ^@ sets the mark at the end of the prefix, and
^E moves the cursor to end of line.
Next time you press up-arrow, ^X^X puts the cursor back at the prefix
again, so ^X^P finds the further previous history with the same prefix.
Then the mark is set and the cursor moved to end of line again.
} From the documentation it seems that up until version 3 something
} like this was normal, and then the history-search-backward etc. was
} changed to only match on the first word.
Yeah, I was never satisfied with the explanations for why that changed.
The new behavior doesn't seem as useful to me.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author