How can I view a list of all of the features that can be checked for using has() in Vim?

I recently came to know the has() function for testing the presence of "features" (see below).

:h features doesn't show a list of features to test for.

How can I see a list of all features that I can test for using has()?

if has('gui_running')
   set background=dark
   colorscheme codedark
"   set termguicolors
   set t_Co=256
   set background=dark
   colorscheme codedark
  • 1
    :h feature-list and scroll down a bit. It lists the feature that can be tested Jul 15 '20 at 8:32
  • Very useful! How did you find this help entry? Does vim support something similar to apropos?
    – Shuzheng
    Jul 15 '20 at 8:40
  • I am just following the links from the help Jul 15 '20 at 8:57
  • In fact, a link to the help for feature-list is three lines into the help for has().
    – B Layer
    Jul 15 '20 at 9:06

The documentation in :help has() has a pointer to the features it can check for:

The {feature} argument is a string, case is ignored. See feature-list below.

If you then look at :help feature-list, you'll see it mentions the three kinds of features that can be tested using has():

There are three types of features:

  1. Features that are only supported when they have been enabled when Vim was compiled +feature-list.
  2. Features that are only supported when certain conditions have been met.
  3. Beyond a certain version or at a certain version and including a specific patch. The "patch-7.4.248" feature means that the Vim version is 7.5 or later, or it is version 7.4 and patch 248 was included.

Note that has("gui_running") is the canonical example of a feature of kind 2. Other examples of kind 2 would be has("vim_starting"), has("ttyin") and has("ttyout").

That description of the three kinds of features is followed by a thorough list of features matching kinds 1 and 2. (I won't reproduce it here, you can find it from the linked documentation or, better yet, from the :help system in your copy of Vim or NeoVim.)

See also :help +feature-list, which covers compile-time options that become features (those of kind 1) in more detail, with links to what those features actually enable.


You can see a list of these features with :version.

This will show you which is available and which is not, as well as your Vim version, compilation method and other information.

  • 1
    Is that a complete list of all (standardised) Vim features, or are such features added on a add-hoc basic by different Vim flavors (vim, nvim, macvim, etc.)? How does has() really work? Is it doing a substring search, i.e. has('vim') tries to match 'vim' against all features listed by :version? Also, are (some of) these features generated by Vim at runtime, because has('vim') is true, when starting Macvim in terminal mode, but false when starting it in GUI mode?
    – Shuzheng
    Jul 15 '20 at 8:33
  • I think you should update your question, I do not have the knowledge to give a more accurate answer.
    – Biggybi
    Jul 15 '20 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.