indentation configuration only for some files

前端 未结 3 1826
醉梦人生
醉梦人生 2021-02-08 10:46

I want to use

git config core.whitespace tab-in-indent,tabwidth=4

I want to have these settings for c++ files, so that I get warnings when ther

3条回答
  •  执念已碎
    2021-02-08 11:14

    As jszakmeister updated from my comment, here's just a sub-section for what you asked about.

    • No tab-in-indent allowed for .cpp/.hpp files
    • Tab's allowed for Makefiles/makefiles and *.mk files
    • No trailing spaces allowed in all
    • tabwidth of 4 in all

    Notice the usage of the - modifier in the 'makefile-ish' entries to say don't call tab-in-indent an error.

    makefile text          whitespace=-tab-in-indent,trailing-space,tabwidth=4
    Makefile text          whitespace=-tab-in-indent,trailing-space,tabwidth=4
    *.mk     text          whitespace=-tab-in-indent,trailing-space,tabwidth=4
    *.cpp    text diff=cpp whitespace=tab-in-indent,trailing-space,tabwidth=4
    *.hpp    text diff=cpp whitespace=tab-in-indent,trailing-space,tabwidth=4
    

提交回复
热议问题