From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Christopher Croughton <crough45@amc.de>, zsh-users@math.gatech.edu
Subject: Re: History key bindings
Date: Thu, 27 Nov 1997 09:55:58 -0800 [thread overview]
Message-ID: <971127095558.ZM2955@candle.brasslantern.com> (raw)
In-Reply-To: <97Nov26.191202gmt+0100.17029@internet01.amc.de>
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
next prev parent reply other threads:[~1997-11-27 18:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-26 17:10 Christopher Croughton
1997-11-27 17:55 ` Bart Schaefer [this message]
1997-11-27 18:21 ` Christopher Croughton
1997-11-27 18:43 ` Bart Schaefer
1997-11-28 8:57 ` Christopher Croughton
1997-11-28 12:30 ` Christopher Croughton
1997-11-28 17:18 ` Bart Schaefer
1997-11-29 13:49 ` Christopher Croughton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=971127095558.ZM2955@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=crough45@amc.de \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).