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

Re: up-line-or-search question



On Thu, Feb 28, 2002 at 07:41:36AM +0100, Dominik Vogt wrote:
> On Wed, Feb 27, 2002 at 04:08:06PM +0000, Oliver Kiddle wrote:
> >  --- Dominik Vogt <dominik.vogt@xxxxxx> wrote: 
> > > 
> > > Actually, that does not do what I want.  I'd need
> > > 
> > >   up-line-or-history-beginning-search-backward
> > >   up-line-or-history-beginning-search-forward
> > > 
> > > Since I still want to be able to navigate through the lines in the
> > > ZLE.
> > 
> > Is this closer to what you want:
> > 
> > up-line-or-beginning-search-backward() {
> >   if [[ $LBUFFER == *$'\n'* ]]; then
> >     zle up-line-or-history
> >   else
> >     zle history-beginning-search-backward
> >   fi
> > }
> > 
> > zle -N up-line-or-beginning-search-backward
> > 
> > If it is, this was discussed some time around about last November. A
> > few variations on the idea were posted including a similar function for
> > forward.
> 
> It's close, but not exactly what I need.  For reference, I have
> attached my final solution including documentation.  Since it
> contains tabs, don't simply copy-and-paste it.

I've tinkered a bit mor with it and used the function Bart posted
as the base and came up with a new version that works a tad more
like up-line-or-search.  The history-beginning-search-...
functions are only used when one actually typed more than the
first word, i.e.

  $ cd /f<Up>

uses history-beginning-search-backward and

  $ cd <Up>

uses up-line-or-search

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: d.vogt@xxxxxxxxxxx
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20

Attachment: zle_updown_funcs.sh
Description: Bourne shell script



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