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
command:
: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:
~/.vim/after/ftplugin/python.vim
, see :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
)
Note the 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!
:verbose set expandtab?
to find out where the setting was last set from.~/.vim/after/ftplugin
.set noexpandtab
in a file inside.vim/after/ftplugin/
directory ?~/.vim/after/ftplugin/py.vim
or use an autocmd. look here stackoverflow.com/questions/28375119/…