How do I find out which file or plugin defined a particular key mapping?
Answer
:verbose map {key}
Explanation
:verbose map {key} shows the definition of a mapping and the file where it was last set. This is essential for debugging unexpected key behavior — when a key does something you did not expect, :verbose map tells you exactly which plugin or config file is responsible.
How it works
:verbose nmap <C-p>
Output:
n <C-p> :Files<CR>
Last set from ~/.vim/plugged/fzf.vim/plugin/fzf.vim line 42
Now you know <C-p> was mapped by fzf.vim.
Variants by mode
| Command | Shows mappings for |
|---|---|
:verbose map {key} |
Normal + Visual + Operator-pending |
:verbose nmap {key} |
Normal mode only |
:verbose imap {key} |
Insert mode only |
:verbose vmap {key} |
Visual + Select mode |
:verbose map |
ALL mappings (no key = list all) |
Example debugging workflow
- Press a key and get unexpected behavior
:verbose nmap <key>to see what it is mapped to and where- Go to the source file to understand or change it
- Or override it in your
~/.vimrc(loaded last, so it wins)
Tips
:verbose set {option}?works too — shows where an option was last set (covered in another trick):verboseprefix works with:command,:autocmd,:highlight, and:functionas well:mapwithout:verboseshows the mapping but not its source file- Use
:filter /pattern/ mapto search mappings by pattern::filter /fzf/ mapshows all fzf-related mappings