Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Features in Vim

📅 2012-Nov-09 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ feature, has, vim ⬩ 📚 Archive

Vim has a list of features whose status information it maintains. These are features compiled into Vim, how it is running and the environment in which it is executing.

The list of features can be seen with the command:

:help feature-list

The has() function of Vim can be used to check the value of any of these features. For example, the gui feature indicates whether Vim has been compiled such that the GUI feature is available. To check whether this is true or not use the command:

:echo has( "gui" )

The answer will be either 0 (false) or 1 (true).

The has() function can be used in Vim configuration files like vimrc or in Vim scripts. For example:

if has( "gui" )
" Do something with GUI
else
" Fallback to non-GUI
endif

Tried with: Vim 7.3