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

Equivalent of Vim's has("feature")?



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