zsh-users
 help / color / mirror / code / Atom feed
* zshzle: aborting history search
@ 2004-07-17 16:49 Georg Neis
  2004-07-17 18:47 ` Wayne Davison
  0 siblings, 1 reply; 9+ messages in thread
From: Georg Neis @ 2004-07-17 16:49 UTC (permalink / raw)
  To: zsh-users

How can I abort history-incremental-search-backward *without* losing
the text that I'm searching for (useful when zsh says "failing
bck-i-search")?

Regards, Georg


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 16:49 zshzle: aborting history search Georg Neis
@ 2004-07-17 18:47 ` Wayne Davison
  2004-07-17 18:56   ` Bart Schaefer
  2004-07-17 19:04   ` Georg Neis
  0 siblings, 2 replies; 9+ messages in thread
From: Wayne Davison @ 2004-07-17 18:47 UTC (permalink / raw)
  To: Georg Neis; +Cc: zsh-users

On Sat, Jul 17, 2004 at 04:49:01PM -0000, Georg Neis wrote:
> How can I abort history-incremental-search-backward *without* losing
> the text that I'm searching for (useful when zsh says "failing
> bck-i-search")?

If you want to go back to where you started your search, just press
Ctrl-G.  If you want to stay on the current line, execute almost any
editor-movement command, such as Ctrl-E, Ctrl-B, Right-Arrow, etc.

..wayne..


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 18:47 ` Wayne Davison
@ 2004-07-17 18:56   ` Bart Schaefer
  2004-07-17 19:04   ` Georg Neis
  1 sibling, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2004-07-17 18:56 UTC (permalink / raw)
  To: zsh-users

On Sat, 17 Jul 2004, Wayne Davison wrote:

> On Sat, Jul 17, 2004 at 04:49:01PM -0000, Georg Neis wrote:
> > How can I abort history-incremental-search-backward *without* losing
> > the text that I'm searching for (useful when zsh says "failing
> > bck-i-search")?
> 
> If you want to go back to where you started your search, just press
> Ctrl-G.

That doesn't work do what he wants; send-break discards the search text,
so, e.g., you can't resume searching for the same thing again later by
pressing the history-incremental-search-backward binding twice in a row.

> If you want to stay on the current line, execute almost any
> editor-movement command, such as Ctrl-E, Ctrl-B, Right-Arrow, etc.

This on the other hand does have the effect of saving the search text.  
So the closest you can get to having both is to invoke end-of-history; but 
that's not normally bound to anything, so you have to create a binding for 
it first.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 18:47 ` Wayne Davison
  2004-07-17 18:56   ` Bart Schaefer
@ 2004-07-17 19:04   ` Georg Neis
  2004-07-17 19:43     ` Felix Rosencrantz
  2004-07-18  2:31     ` Bart Schaefer
  1 sibling, 2 replies; 9+ messages in thread
From: Georg Neis @ 2004-07-17 19:04 UTC (permalink / raw)
  To: zsh-users

* Wayne Davison <wayned@users.sourceforge.net> wrote:
> On Sat, Jul 17, 2004 at 04:49:01PM -0000, Georg Neis wrote:
> > How can I abort history-incremental-search-backward *without* losing
> > the text that I'm searching for (useful when zsh says "failing
> > bck-i-search")?
> 
> If you want to go back to where you started your search, just press
> Ctrl-G.  If you want to stay on the current line, execute almost any
> editor-movement command, such as Ctrl-E, Ctrl-B, Right-Arrow, etc.

Sorry, my description wasn't clear enough.  Here's an example:

I have a new prompt and want to execute "cat /foo/bar".  I remember
that I executed this command some days ago and thus type ^R to go
into history-incremental-search-backward mode.  Now the
"bck-i-search:" prompt appears.  There I type "cat /fo" and
"bck-i-search: cat /fo" turns into "failing bck-i-search: cat /fo"
because the command is (for whatever reasons) not in my history file.
Now I want to be able to abort the search while transfering "cat /fo"
from the search prompt to the normal command prompt in order to
complete it manually.

Regards, Georg


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 19:04   ` Georg Neis
@ 2004-07-17 19:43     ` Felix Rosencrantz
  2004-07-26  9:36       ` Peter Stephenson
  2004-07-18  2:31     ` Bart Schaefer
  1 sibling, 1 reply; 9+ messages in thread
From: Felix Rosencrantz @ 2004-07-17 19:43 UTC (permalink / raw)
  To: Georg Neis, zsh-users

One thing you might look at is the LASTSEARCH zle parameter.

I think there is some funkiness with the incremental search widgets like
history-incremental-search-backward widget that you might have to be careful
about.  I had an opposite request, take text I typed on the command line and
make it go into the search buffer.  Bart provided a very helpful solution in a
thread around zsh-users/3991 (http://www.zsh.org/mla/users/2001/msg00401.html).

-FR.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 19:04   ` Georg Neis
  2004-07-17 19:43     ` Felix Rosencrantz
@ 2004-07-18  2:31     ` Bart Schaefer
  2004-07-18  9:21       ` Georg Neis
  1 sibling, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2004-07-18  2:31 UTC (permalink / raw)
  To: zsh-users

On Sat, 17 Jul 2004, Georg Neis wrote:

> "bck-i-search: cat /fo" turns into "failing bck-i-search: cat /fo" 
> because the command is (for whatever reasons) not in my history file. 
> Now I want to [move] "cat /fo" from the search prompt to the normal 
> command prompt

copy-search-as-buffer() { zle end-of-history; BUFFER="$LASTSEARCH" }
zle -N copy-search-as-buffer
bindkey '\ee' copy-search-as-buffer

Choose your own binding in place of escape-e, I just picked something that 
isn't bound by default.  The "end-of-history" isn't strictly necessary, 
but it means you aren't left with a modified buffer in the middle of the 
history after the first part of the incremental scan.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-18  2:31     ` Bart Schaefer
@ 2004-07-18  9:21       ` Georg Neis
  0 siblings, 0 replies; 9+ messages in thread
From: Georg Neis @ 2004-07-18  9:21 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sat, 17 Jul 2004, Georg Neis wrote:
> 
> > "bck-i-search: cat /fo" turns into "failing bck-i-search: cat /fo" 
> > because the command is (for whatever reasons) not in my history file. 
> > Now I want to [move] "cat /fo" from the search prompt to the normal 
> > command prompt
> 
> copy-search-as-buffer() { zle end-of-history; BUFFER="$LASTSEARCH" }
> zle -N copy-search-as-buffer
> bindkey '\ee' copy-search-as-buffer

Great - that works.  I only added CURSOR="$#BUFFER" to the function's
definition.

So long, and thanks for all the answers!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-17 19:43     ` Felix Rosencrantz
@ 2004-07-26  9:36       ` Peter Stephenson
  2004-07-28 14:52         ` Felix Rosencrantz
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 2004-07-26  9:36 UTC (permalink / raw)
  To: zsh-users

Felix Rosencrantz wrote:
> One thing you might look at is the LASTSEARCH zle parameter.
> 
> I think there is some funkiness with the incremental search widgets like
> history-incremental-search-backward widget that you might have to be careful
> about.  I had an opposite request, take text I typed on the command line and
> make it go into the search buffer.  Bart provided a very helpful solution in 
> a
> thread around zsh-users/3991 (http://www.zsh.org/mla/users/2001/msg00401.html
> ).

I reread that... the internal function doisearch() is crying out to
use a special keymap and a recursive edit.  Currently the behaviour is
hardcoded onto certain widgets, which is why trying to get it to do
something unusual is difficult.

Possibly, doing it that way, you could get a better version of
history-incremental-search-backward as a shell function than the current
internal one.  However, there may be things that aren't so easy.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zshzle: aborting history search
  2004-07-26  9:36       ` Peter Stephenson
@ 2004-07-28 14:52         ` Felix Rosencrantz
  0 siblings, 0 replies; 9+ messages in thread
From: Felix Rosencrantz @ 2004-07-28 14:52 UTC (permalink / raw)
  To: zsh-users

--- Peter Stephenson <pws@csr.com> wrote:

> I reread that... the internal function doisearch() is crying out to
> use a special keymap and a recursive edit. 

I find I use incremental search alot, so I would applaud a rewrite of the
incremental search code.  Especially if it made that code more scriptable from
zle.  There are quite a few features that might be useful to add (e.g. history
of past searches, show multiple matching history lines, color matching portion
in current line, grab word of current match, correct characters that cause the
search to fail, etc.)

-FR.

P.S. Hope my message doesn't end up in spam jail again.  It took a week for my
last message to make it to the list.


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-07-28 14:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-17 16:49 zshzle: aborting history search Georg Neis
2004-07-17 18:47 ` Wayne Davison
2004-07-17 18:56   ` Bart Schaefer
2004-07-17 19:04   ` Georg Neis
2004-07-17 19:43     ` Felix Rosencrantz
2004-07-26  9:36       ` Peter Stephenson
2004-07-28 14:52         ` Felix Rosencrantz
2004-07-18  2:31     ` Bart Schaefer
2004-07-18  9:21       ` Georg Neis

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