3

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.

mcandre
  • 22,868
  • 20
  • 88
  • 147

2 Answers2

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
Community
  • 1
  • 1
Eevee
  • 47,412
  • 11
  • 95
  • 127
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