In my vimrc I use :setg tabstop=4 shiftwidth=4. Why aren't unnamed buffers set correctly with these values? Using VIM 8.2.460 (2019 Dec 12)

I opened vim with some piped output and noticed tab width was 8. So I typed:

:setglobal tabstop?
        Last set from /etc/vim/vimrc.local line 36

:setlocal tabstop?

If I use :setlocal, some options are shown but tabstop is not in the list. This means it's picking the vim default (8).

Anyone have any ideas about this? Aren't global options supposed to be used for new buffers?


This is the first buffer only.

While vimrc is being sourced the buffer #1 already exists (but unloaded), and so it has its local option values (default ones). Now when you setglobal tabstop you don't change it, so it's still eight.

  • Thanks for your response. That came to my mind but I wasn't sure. I guess I'll just save and then reload the file from now on, with :e! – Elizandro - SparcBR Apr 15 '20 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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