vimtricks.wiki Concise Vim tricks, one at a time.

How do I find where a Vim option or mapping was last set?

Answer

:verbose set option?

Explanation

The :verbose prefix shows where an option was last set (which file, which line). This is invaluable for debugging configuration issues.

How it works

  • :verbose set number? shows where number was set
  • :verbose map <C-p> shows where a mapping was defined
  • :verbose highlight Normal shows where a highlight was set

Example

:verbose set tabstop?
  tabstop=4
        Last set from ~/.vimrc line 42

Tips

  • Essential for debugging conflicting settings
  • Works with :set, :map, :autocmd, :highlight
  • :verbose autocmd BufRead shows all BufRead autocommands with sources
  • :scriptnames lists all sourced script files in order

Next

How do you yank a single word into a named register?