I'm using only TAB for indent, so I configure Vim for using only them:

set autoindent
set noexpandtab
set tabstop=4
set shiftwidth=4

But some files (.py) still using spaces. I've search for it and found:

filetype plugin indent on

But this has not help, and I've try:

au FileType python setlocal noexpandtab

But this has help only for python. So how to apply noexpandtab for all file types?

  • 2
    Actually, as it turns out, Python is a bit of an exception. You are meant to only use spaces (not tabs) for Python programming.
    – HalosGhost
    Commented Jul 13, 2014 at 6:11
  • 2
    I'm curious why this is downvoted so much. The question is clear and concise. And it shows the OP has put forth effort in solving it. Just because you don't agree with the practice doesn't make the question bad.
    – phemmer
    Commented Jul 13, 2014 at 7:57

1 Answer 1


Some vim syntaxes set certain settings when the file is opened. As you've found, you can get around this by using an autocmd to set the setting after the syntax has finished.
To get the autocmd to apply on all file types, use a *. For example:

autocmd FileType * set noexpandtab

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .