It is not ignored, it is overwritten by your filetype plugin. In this case the python plugin. You can verify that like Marth said, with the
:verbose set expandtab?
If you want to overwrite the setting in the filetype plugin, you should go for one of the following ways:
Put your settings in a after file:
:h after for more information.
Use an autocommand:
:autocmd FileType python setlocal noexpandtab, see
:h auto for more information. *This must be done after the line which activates the filetype plugins (possibly something like
:filetype plugin on)
setlocal, you should use this instead of
set in both, the autocmd and your after file. Else you can get it all mixed up if you open different filetypes in the same instance.
DISCLAIMER: Most Lines are directly taken from this SO post: Override options set by ftplugins in vim or the comment of Marth. This answer only adjust them for the given problem. So if this helped you, think about leaving an upvote there!