1

In my ~/.vim/vimrc, I have:

set shiftwidth=4 set tabstop=4 

and when I edit a plain text file, that is respected. However, when I edit a CMake file - these both becomes 8. I tried looking for the cause of this change, but couldn't figure it out:

  • Nothing in /usr/share/vim/vim90/syntax/cmake.vim seems to be related to tab stops, or to include another vim file.
  • Same for /usr/share/vim/vim90/syntax/cmake.vim.
  • The CMakeLists.txt files I'm editing have no modeline.

What's causing this? Is there a definition I've missed? And - can I override it somehow?

4
  • ftplugin/cmake.vim would more likely contain such a setting than syntax/cmake.vim, but the version on my machine doesn't seem to alter those settings either. Are you sure the file you're editing doesn't have a modeline? Commented Dec 23, 2023 at 0:51
  • @jwodder: Nothing relevant there either... also, the file has no modeline. Commented Dec 23, 2023 at 15:23
  • 1
    What does :verbose set tabstop? show? Commented Dec 23, 2023 at 15:26
  • @muru: Ah-ha! Last set from ~/.vim/pack/tpope/start/sleuth/plugin/sleuth.vim ... shall you write the answer or shall I? Commented Dec 23, 2023 at 18:44

1 Answer 1

3

To see in which startup files an option was set, use :verbose set <option>?. From :help :verbose-cmd:

When 'verbose' is non-zero, listing the value of a Vim option or a key map or an abbreviation or a user-defined function or a command or a highlight group or an autocommand will also display where it was last defined. If it was defined manually then there will be no "Last set" message. When it was defined while executing a function, user command or autocommand, the script in which it was defined is reported.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.