zsh-workers
 help / color / mirror / code / Atom feed
* zsh, vi mode, vihistorysearchbackward
@ 1996-06-19 16:44 J.D. Laub
  1996-06-19 17:04 ` Zefram
  0 siblings, 1 reply; 7+ messages in thread
From: J.D. Laub @ 1996-06-19 16:44 UTC (permalink / raw)
  To: zsh-workers

I've a question with the following revision:

% rcsdiff -r1.7 -r1.8 zle_bindings.c
2c2
<  * $Id: zle_bindings.c,v 1.6 1995/03/11 06:17:29 [name omitted to protect the good-intentioned 8-) ]
---
>  * $Id: zle_bindings.c,v 1.7 1995/03/20 22:11:36 [name omitted to protect the good-intentioned 8-) ]
[...]
541c547
<     /* / */ z_vihistorysearchbackward,
---
>     /* / */ z_vihistorysearchforward,
557c563
<     /* ? */ z_vihistorysearchforward,
---
>     /* ? */ z_vihistorysearchbackward,

The above mappings appear in vicmdbind, and my question concerns
running zsh in vi mode.

I can see how "/" should seem to be "search forward" and "?" should be
"search backward", but this works exactly opposite as it did before.
Most of the time I want to just hit "ESC-/" to search back a few lines
to a previous command, but with the above (default) bindings I have to
add the shift key to make it "ESC-?", which is more awkward.

I've used a couple bindkeys in my own .zshrc to switch the two
functions (putting "backwards" back on "/"), but I'm pushing others
here to switch from ksh to zsh, and I think the default behavior
will confuse them (since the default bindings work exactly opposite
as ksh in vi mode).  Anybody (dis)agree with switching them back?
Discussion?
-- 
J.D. Laub (Laubster) HBOC/CliniCom|"I think you're very, very, very, very, very,
jdl@clinicom.com     Boulder,CO   |very, very, very, very, ..." - Flying Lizards



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 16:44 zsh, vi mode, vihistorysearchbackward J.D. Laub
@ 1996-06-19 17:04 ` Zefram
  1996-06-19 18:01   ` Hrvoje Niksic
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zefram @ 1996-06-19 17:04 UTC (permalink / raw)
  To: J.D. Laub; +Cc: zsh-workers

>I can see how "/" should seem to be "search forward" and "?" should be
>"search backward", but this works exactly opposite as it did before.

We are trying to emulate vi, rather than ksh.  As a vi user, I find the
new bindings much more intuitive -- ? is a backward search, so that's
what I use to search backward through the history.


>I've used a couple bindkeys in my own .zshrc to switch the two
>functions (putting "backwards" back on "/"), but I'm pushing others
>here to switch from ksh to zsh, and I think the default behavior
>will confuse them (since the default bindings work exactly opposite
>as ksh in vi mode).  Anybody (dis)agree with switching them back?

If you really want to have the default state match ksh, give everyone a
.zshrc including these bindings.

-zefram



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 17:04 ` Zefram
@ 1996-06-19 18:01   ` Hrvoje Niksic
  1996-06-19 19:21     ` Zefram
  1996-06-19 18:58   ` Barton E. Schaefer
  1996-06-19 22:47   ` Richard Coleman
  2 siblings, 1 reply; 7+ messages in thread
From: Hrvoje Niksic @ 1996-06-19 18:01 UTC (permalink / raw)
  To: ZSH Workers Mailing List

Zefram (A.Main@dcs.warwick.ac.uk) wrote:
> If you really want to have the default state match ksh, give everyone a
> .zshrc including these bindings.

Or put it in /etc/zshrc.

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
I'm a Lisp variable -- bind me!



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 17:04 ` Zefram
  1996-06-19 18:01   ` Hrvoje Niksic
@ 1996-06-19 18:58   ` Barton E. Schaefer
  1996-06-19 22:47   ` Richard Coleman
  2 siblings, 0 replies; 7+ messages in thread
From: Barton E. Schaefer @ 1996-06-19 18:58 UTC (permalink / raw)
  To: Zefram, J.D. Laub, zsh-workers

On Jun 19,  6:04pm, Zefram wrote:
} Subject: Re: zsh, vi mode, vihistorysearchbackward
}
} >I can see how "/" should seem to be "search forward" and "?" should be
} >"search backward", but this works exactly opposite as it did before.
} 
} We are trying to emulate vi, rather than ksh.  As a vi user, I find the
} new bindings much more intuitive -- ? is a backward search, so that's
} what I use to search backward through the history.

In point of fact, I never in memory have *ever* wanted to search forward
through the history.  (If I had my druthers, *any* search other than an
immediate repeat of the previous search would always start at the current
command (the end of the history) and go backwards; treating the history
as if it were a file being edited makes no sense to me at all.)  I think
the ksh behavior is more intuitive, because I don't think of history as
existing in more than one direction; so having two commands to search it
is confusing enough to begin with.

Further, it's really confusing to have ESC-/ fail to find something that
you know you typed only moments before.  If `/' isn't going to search
backwards, then it at least ought to wrap around (like "wrapscan" in vi).

I don't use vi mode, so I haven't bothered complaining about it before.

} If you really want to have the default state match ksh, give everyone a
} .zshrc including these bindings.

Is there a way to tell from within the shell that it was invoked as ksh?
Perhaps an /etc/zshenv like this:

    if [[ -o interactive && $0 = *ksh ]]
    then
	bindkey -a / vi-history-search-backward
	bindkey -a \? vi-history-search-forward
    fi

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@z-code.com                   Division of NetManage Corporation
http://www.well.com/www/barts           http://www.ncdsoft.com/ZMail/



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 18:01   ` Hrvoje Niksic
@ 1996-06-19 19:21     ` Zefram
  0 siblings, 0 replies; 7+ messages in thread
From: Zefram @ 1996-06-19 19:21 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zsh-workers

>Zefram (A.Main@dcs.warwick.ac.uk) wrote:
>> If you really want to have the default state match ksh, give everyone a
>> .zshrc including these bindings.
>
>Or put it in /etc/zshrc.

Generally not a good idea.  That would mean that zsh users, expecting
normal zsh behaviour, would have to set it explicitly.

However, the idea of having searches wrap (from Bart) is good.  I'll
implement this sometime if no one else gets to it first.

-zefram



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 17:04 ` Zefram
  1996-06-19 18:01   ` Hrvoje Niksic
  1996-06-19 18:58   ` Barton E. Schaefer
@ 1996-06-19 22:47   ` Richard Coleman
  1996-06-20  0:10     ` Vinnie Shelton
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Coleman @ 1996-06-19 22:47 UTC (permalink / raw)
  To: zsh-workers

> >I can see how "/" should seem to be "search forward" and "?" should be
> >"search backward", but this works exactly opposite as it did before.
> 
> We are trying to emulate vi, rather than ksh.  As a vi user, I find the
> new bindings much more intuitive -- ? is a backward search, so that's
> what I use to search backward through the history.
> 
> 
> >I've used a couple bindkeys in my own .zshrc to switch the two
> >functions (putting "backwards" back on "/"), but I'm pushing others
> >here to switch from ksh to zsh, and I think the default behavior
> >will confuse them (since the default bindings work exactly opposite
> >as ksh in vi mode).  Anybody (dis)agree with switching them back?
> 

I think the interpretation should be that "/" searches the `natural'
direction (whatever that is) and "?" searches the reverse of that.
With that interpretation, the previous behavoir is more natural.  As
Bart said, you rarely ever want to search forward (down) the history.
The `natural' direction is always to search up the history.

rc



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

* Re: zsh, vi mode, vihistorysearchbackward
  1996-06-19 22:47   ` Richard Coleman
@ 1996-06-20  0:10     ` Vinnie Shelton
  0 siblings, 0 replies; 7+ messages in thread
From: Vinnie Shelton @ 1996-06-20  0:10 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers


coleman@math.gatech.edu said:
> I think the interpretation should be that "/" searches the `natural' 
> direction (whatever that is) and "?" searches the reverse of that. 
> With that interpretation, the previous behavoir is more natural.  As 
> Bart said, you rarely ever want to search forward (down) the history. 
> The `natural' direction is always to search up the history. 

I much prefer this interpretation.  I'd like to see '/' restored as the 
natural search character in vi mode.

--vin



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

end of thread, other threads:[~1996-06-20  0:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-19 16:44 zsh, vi mode, vihistorysearchbackward J.D. Laub
1996-06-19 17:04 ` Zefram
1996-06-19 18:01   ` Hrvoje Niksic
1996-06-19 19:21     ` Zefram
1996-06-19 18:58   ` Barton E. Schaefer
1996-06-19 22:47   ` Richard Coleman
1996-06-20  0:10     ` Vinnie Shelton

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