Git is now must-have version control system and you write .gitignore files when using it. Sometimes they become large and complicated, but GitHub provides the official collection of .gitignore templates in https://github.com/github/gitignore, so why don't you use them?
You can use them in Vim with great ease.
-
:Gitignore [Foo...]
This adds the patterns for
Foo
filetype to.gitignore
in the project root. -
:Gitignore! [Foo...]
This is almost the same as the above, but discard the existing
.gitignore
content before. -
:GitignoreUpdate
This updates the .gitignore template collection in
g:gitignore_dir
.
This can be installed by using any plugin-managers like Vundle.vim, but if you don't have your favorite one, I recommend vim-plug.
Install it and write the below line in your .vimrc
:
Plug 'iwataka/gitignore.vim'
For other plugin-managers, please see their own documents.
-
g:gitignore_dir
(default value:~/.gitignore-boilerplates
)This specify the directory which contains the .gitignore template collection. By default, this uses the same directory as gibo, which means no additional downloading even if using gibo.
-
g:gitignore_enable_shallow_clone
(default value: 1)If this value is non-zero, this plug-in uses shallow-clone.
- You'll see no duplicated patterns even if running
Gitignore Foo
twice!
-
Syntax highlighting, code snippets and tComment support
-
Automatically add the entries in a .gitignore file to
wildignore