Setting Vim whitespace preferences by filetype

前端 未结 5 1353
遇见更好的自我
遇见更好的自我 2020-12-04 04:50

At my work, I am required to follow the house style for indentation, which goes as follows:

  • 2 spaces when coding html and ruby
  • tabs when coding javasc
5条回答
  •  盖世英雄少女心
    2020-12-04 05:23

    There's also a nice vim script: DetectIndent which tries to detect the indentation of a file that you open. It's very handy if you work with many files with different coding style.

    I use an autocommand in my .vimrc:

    :autocmd BufReadPost * :DetectIndent 
    

提交回复
热议问题