Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Equivalent of Vim's has("feature")?
- X-seq: zsh-users 15563
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Equivalent of Vim's has("feature")?
- Date: Mon, 22 Nov 2010 12:12:51 -0500 (EST)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Vim has a function 'has()' that lets you test for features compiled in
to the running version of Vim. So, e.g.:
if has('perl')
" do something using the Perl interface for Vim
endif
I suspect there is similar functionality for Zsh, but I'm not quite sure
where to look. I'd rather use something like 'has()' than something
involving ZSH_VERSION or similar.
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,
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.
--
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author