sponsor Vim development Vim logo Vim Book Ad

gitignore : Set 'wildignore' from ./.gitignore

 script karma  Rating 50/17, Downloaded by 2013  Comments, bugs, improvements  Vim wiki

created by
Adam Bellaire
script type
Another one from StackOverflow.

It will read your .gitignore file from the directory where you launch vim and parse it, transforming its format into one suitable for wildignore, and then set that option.  Thus, tab-completion won't present those files as options when using vim commands that expect a filename.

* This will read the .gitignore file from the directory where you launch vim. No effort is made to look for other .gitignore files and parse them. Alternatively, you could specify an absolute path to a file on the first line.
* The wildignore option in vim doesn't support the notion of negating ignores like you can in a .gitignore file. That is, you can't say :set wildignore=*.html,!foo.html to have it ignore all html files except foo.html. Therefore, .gitignore lines that start with ! are simply ignored.
install details
Place the file in your plugin directory, such as ~/.vim/plugin/

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
gitignore.vim 0.4 2017-05-25 7.0 Adam Bellaire Incorporates fix by Lukas Erlacher to escape commas found in gitignore
gitignore.vim 0.3 2016-09-14 7.0 Adam Bellaire Fixes for spaces in filenames from Lukas Erlacher
gitignore.vim 0.2 2012-09-05 7.0 Adam Bellaire New functionality by Giuseppe Rota, includes fugitive integration and moves behavior into a callable/mappable function.
gitignore.vim 0.1 2009-02-26 6.0 Adam Bellaire Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.