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

How do I find which plugin or script defined a specific mapping?

Answer

:verbose nmap <leader>

Explanation

The :verbose prefix on mapping commands shows not just the mapping definition but also the file and line number where it was defined. This is essential for debugging mapping conflicts or understanding which plugin owns a keybinding.

How it works

  • :verbose nmap {key} — shows where the normal mode mapping was defined
  • :verbose imap {key} — same for insert mode
  • :verbose set {option}? — shows where an option was last set
  • The output includes the exact file path and line number

Example

:verbose nmap <leader>f
n  <leader>f    :Files<CR>
        Last set from ~/.vim/plugged/fzf.vim/plugin/fzf.vim line 42
:verbose set tabstop?
  tabstop=4
        Last set from ~/.vimrc line 15

Tips

  • Use :verbose map (no key) to list ALL mappings with their sources
  • Set verbosefile to log all verbose output to a file: :set verbosefile=/tmp/vim.log
  • :verbose works with any command: :verbose autocmd BufRead
  • Higher verbose levels: :15verbose {cmd} shows even more detail about script execution

Next

How do I return to normal mode from absolutely any mode in Vim?