Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Equivalent of Vim's has("feature")?
On Mon, 22 Nov 2010 12:12:51 -0500 (EST)
"Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:
> For commands and widgets I've found the following to work well:
>
> (( $+commands[screen] )) && # do something with screen
>
> (( $+widgets[history-incremental-pattern-search-backward] )) \
> && bindkey "^R" history-incremental-pattern-search-backward
>
> But, 1) I can't seem to rediscover the documentation for those
> arrays,
Look at the documentation for the zsh/parameter module in zshmodules.
> and 2) Is there such an array for things that are more
> inbuilt? In particular, I'm looking for a test that the ':A' history
> modifier exists.
If you haven't recorded the version when it first appeared so you can
use the is-at-least function, which is the usual way (as long as you do
it as soon as the feature appears it's painless), you have to attempt to
make use of the feature and record the result.
integer history_A
( : ${PATH:A} ) 2>/dev/null && history_A=1
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author