tpope / vim-apathy

apathy.vim: Set the 'path' option for miscellaneous file types
180 stars 9 forks source link

apathy.vim

Apathy sets the five path searching options — 'path', 'suffixesadd', 'include', 'includeexpr', and 'define' — for file types I don't care about enough to bother with creating a proper plugin.

Rationale

As you might have guessed from /usr/include being in the default, the original purpose of the 'path' option was to house the C preprocessor include path. This enabled Vim to parse a preprocessor declaration like #include <stdio.h> and determine that the file being included was /usr/include/stdio.h. Several features are built-in on this groundwork:

I list these exhaustively to stress that included files aren't just a potential use of 'path', they are the very purpose of 'path'. If you've been using 'path' to contain a list of commonly accessed directories or something like **/*, you're precluding yourself from using 38 different commands. Oops! (Try one of the many fuzzy finder plugins instead.)

While Vim is set up for C by default, it provides a few options to use these features for other languages:

These, along with 'path', make up the purview of Apathy.

Supported file types

Additionally, the C related defaults are stripped out of the global config, so you don't have to worry about /usr/include tainting everything.

Related plugins

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/apathy.git

License

Copyright © Tim Pope. Distributed under the same terms as Vim itself. See :help license.