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 wherenumberwas set:verbose map <C-p>shows where a mapping was defined:verbose highlight Normalshows 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 BufReadshows all BufRead autocommands with sources:scriptnameslists all sourced script files in order