Can I make vim respect my .gitignore files?

前端 未结 3 733
时光取名叫无心
时光取名叫无心 2021-02-05 15:16

I was wondering if there is a way to get vim to read .gitignore files and use them to determine options not to present when auto-completing filenames.

For example, work

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 15:43

    I wrote a plugin for this: https://github.com/octref/RootIgnore

    It can add .gitignore patterns to your wildignore automatically.
    Some handy features:

    • When you are in a sub directory, like this:
    my_proj/  
       .gitignore  
       .git/
       sub/
    

    If you cd into sub, and open Vim there, the plugin goes recursively up to find the .gitignore and add it to wildignore.

    • You can easily add ~/.gitignore rules by let g:RootIgnoreUseHome = 1.

提交回复
热议问题