I'd like to default to soft tabs, indented two spaces (but hard tabs displayed as two spaces for Makefiles), and for vim to reindent appropriately on save.
Asked
Active
Viewed 1,279 times
2 Answers
4
See this question. For your case, you would want this in your .vimrc
:
set tabstop=2
set softtabstop=2
set expandtab
And this in ~/.vim/after/ftplugin/make.vim
:
setlocal noexpandtab
3
You can use autocmd
for this, so it pretty much becomes a oneliner in your.vimrc
autocmd Filetype jade setlocal ts=2 sw=2 expandtab
autocmd Filetype yaml setlocal ts=2 sw=2 expandtab
Everything else will still use the global defaults.

Ivo Wetzel
- 46,459
- 16
- 98
- 112