I have the following line in my vimrc:

autocmd Filetype html setlocal tabstop=8 softtabstop=8 shiftwidth=8 expandtab

Doesn't count for anything when I open an html file:

:set expandtab? sts?

How can I go about figuring out what is resetting expandtab and softtabstop? In general, what can I do to find out what is making a certain change, between vimrc, my own installed plugins, plugins in the distribution, &c

I tried searching the files from :scriptnames for references to softtabstop. Some reference it or set it to 8, but none of these seem to be setting it to zero (or any other variable value).

If somebody is inclined, I'd welcome a glance at my vimrc and :scriptnames output in case the problem is obvious from these. You can find them here.


3 Answers 3


Run :verbose set <name>, e.g.:

:verbose set tabstop
      Last set from ~/.vim/settings.vim

:verbose also works with other commands (e.g. :map). See :help :verbose.

  • This wound up giving me nothing! Reason (see my answer) is that nothing actually set it in the first place -- my filetype was wrong and my autocmd wasn't executing. Apparently you get no "last set" message either if you set the variable yourself or if it is at a system default.
    – jsharp
    Sep 22, 2016 at 0:12

Managed to figure it out:

:set filetype? " expecting html here

Makes sense because I do have a jinja plugin at work. Same autocmd for "jinja" filetype instead of html and I'm good to go.

Compiling a few things I learned along the way in case somebody else finds this answer:

  • :set filetype? as seen above tells you what filetype vim thinks you are in
  • :verbose set <var> tells you where the variable was last set. If it does not, you either set it yourself, or it's at system default (as was the case with me). Thank you @Carpetsmoker!
  • This answer is a good resource. Thank you (again) @Carpetsmoker for making the resource, and @Tumbler41 for pointing me to it!
  • Another good resource at vim wikia.

Thanks for the help!


I use vim installed by brew on a mac os 10.12.6. I'm currently coding in ruby. In my case, a recent update to vim 8.1-153 caused a change in softtabstop and expandtabs. Using the method above by Martin Tournoij I determined that this file controlled the settings:


My attempts to override the settings in my ~/.gvimrc did not work. I ended up modifying the installation's ruby.vim file (as above) which I did not want to do. Here is the code with changes:

if get(g:, 'ruby_recommended_style', 1)
  setlocal shiftwidth=4 softtabstop=4 noexpandtab
  let b:undo_ftplugin .= ' | setl sw< sts< et<'
  • 1
    I don't think that really answers OP question. Anyway the right way to override a setting in an ftplugin is described at :h ftplugin-overrule. You want to create ~/.vim/after/ftplugin/ruby.vim and change the settings in this file.
    – statox
    May 2, 2019 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.