Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Wishlist for zsh: 3 tcsh features
- X-seq: zsh-users 4359
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: Wishlist for zsh: 3 tcsh features
- Date: Tue, 9 Oct 2001 15:08:30 +0000
- In-reply-to: <3BC308CD.272E1CCB@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20011008161313.EC4ACD804@xxxxxxxxxxxxxxxxx> <OF594BCCA9.4364E8B5-ON80256ADF.0059B87C@xxxxxxxxxxxxxxx> <3BC1DDEE.FA306604@xxxxxxxxxxx> <1011008173916.ZM5532@xxxxxxxxxxxxxxxxxxxxxxx> <3BC308CD.272E1CCB@xxxxxxxxxxx>
On Oct 9, 3:25pm, Oliver Kiddle wrote:
}
} Bart Schaefer wrote:
}
} > function up-line-or-beginning-search {
} > if [[ $LASTWIDGET != $WIDGET ]]
} > then
} > if [[ $BUFFER == *$'\n'* ]]
} > then
} > __last_up_line=up-line-or-history
} > else
} > __last_up_line=history-beginning-search-backward
} > fi
} > fi
} > zle .${__last_up_line:-beep}
} > }
}
} I presume that the LASTWIDGET check and __last_up_line saving is there
} so that if the history search retrieved a multi-line command, it would
} continue to use history-beginning-search-backward.
Yes.
} Unfortunately, this means it won't do a history search from the first
} line of a multi-line buffer
The BUFFER test means that; but what the LASTWIDGET test means is that
if you start somewhere other than at the first line and move upwards,
it won't switch from moving to searching just because you happen to get
to the top line. I find up-line-or-search a bit strange that way.
} so I changed it to this:
}
} if [[ ${BUFFER[1,CURSOR]} == *$'\n'* ]]; then
} zle up-line-or-history
} else
} zle history-beginning-search-backward
} fi
BUFFER[1,CURSOR] is of course LBUFFER ...
} Please let me know if that has problems which I missed. Next I'll have
} to get it to do something more useful from a PS2 prompt.
The PS2 prompt is a bit of a pain in the neck. The only way I've found
to tell whether you're at the PS2 prompt is with
[[ -n ${(%):-%_} ]]
and that only works if you're in a shell construct; if you're just on a
backslash-continuation line, there's no way to detect it. Is there?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author