In my vimrc, I have set expandtab. When I edit a Tex file, however, Vim inserts tab characters , instead of spaces , when I press tab. I figured noexpandtab must be set by the TeX ftplugin for some strange reason, but I was wrong. If I type set expandtab? , it returns noexpandtab. Also, verbose set expandtab? reveals that Vim believes my vimrc has instead set noexpandtab.

Executing verbose set expandtab? returns noexpandtab Last set from ~/.config/vim/vimrc line 69.
Line 69 of my vimrc is set expandtab

Is this a bug? I can set expandtab in my Vim session with a TeX file open and new tabs are spaces as expected. Am I missing something?

  • What is the exact output of set verbose et? in particular what is the line nb mentioned and what is the content of the .vimrc in particular at the mentioned line nb (maybe you have expandtab mentioned twice or indirectly) Aug 17, 2023 at 13:48
  • 2
    verbose set expandtab? returns noexpandtab Last set from ~/.config/vim/vimrc line 69. Line 69 of my vimrc is set expandtab.
    – Wil
    Aug 17, 2023 at 13:56
  • Do you run the command set verbose et? when the TeX buffer is loaded or right after Vim has started? To analyze your TeX problem you have to run the command when the focus is on the TeX buffer. Aug 17, 2023 at 14:59
  • Some times , the userid may be the culprit Eg , you may be running vim as root , but you may be checking "~/.config/vim/vimrc" in your home Directory. I would double check whether line 69 is "set expandtab" or "set noexpandtab" in the Correct vimrc. I would add some newlines to the vimrc to move that setting to line 75 & then recheck what vim reports !
    – Prem
    Aug 17, 2023 at 15:16

2 Answers 2


As you figured out, the problem was that the option was set as a result of setting another option. I opened an issue about this, and the Vim developers sprang into action and fixed it a few days later.

As of Vim 9.0.1781, the verbose command should correctly report where option have been set indirectly.

(I'll update this with the actual output as soon as I've had a chance to test it.)


The problem was that I had set binary in my vimrc from years ago. Removing this option fixed the problem. The Vim documentation says that binary will set expandtab (among other settings) to off. However, this is not reported by set expandtab? or verbose set expandtab?.

On a side not, my vimrc is in non-traditional location. I export VIMINIT=source ~/.config/vim/vimrc. The same behavior as described in my question and this answer occurs even if the vimrc is placed in ~/.vimrc.

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.