在我的工作中,我需要遵循房屋风格进行缩进,如下所示:
- 编码 html 和 ruby 时有 2 个空格
- 编码 JavaScript 时使用制表符,建议使用 tabwidth=4
为每个文件类型指定不同的空白首选项的最佳方法是什么?
最佳答案
方法有很多,但这里介绍一种简单易懂的方法。将这些行添加到您的 ~/.vimrc
中:
autocmd FileType html setlocal ts=2 sts=2 sw=2
autocmd FileType ruby setlocal ts=2 sts=2 sw=2
autocmd FileType javascript setlocal ts=4 sts=4 sw=4
关于vim - 按文件类型设置 Vim 空白首选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1562633/