Can I make vim respect my .gitignore files?

前端 未结 3 731
时光取名叫无心
时光取名叫无心 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:59

    Vim will ignore file patterns specified in option wildignore , so you can set them like so:

    :set wildignore=*.o,*~,*.pyc
    

    Or place the same line (without the ":") in your ~/.vimrc file. If you need something more dynamic like adjusting to the .gitignore in the current directory then you'll need to do some scripting, but I'll leave that as an exercise for someone else.

提交回复
热议问题