Search your mappings

3.8
(198)

Vim power users will often create dozens of custom key mappings: configuration commands that are used to modify the meaning of typed keys. There are 6 distinct lists of mappings for different Vim modes. In addition to Vim’s own key combinations, plugins often add mappings. Plus, mappings added to your .vimrc allow total customization of your Vim setup.

But have you ever forgotten a mapping you created? I have. Luckily, there is an easy way to search through all your mappings, right at the point of use in Vim:

  • :filter your_pattern imap – searches insert mode mapping list for “your pattern”
  • :filter your_pattern nmap – searches normal mode mapping list for “your pattern”

You can also just list all the mappings from a certain list with simple :nmap, :imap, etc. If you have a lot of mappings, this might not be helpful for searching. But it can help you get an overview or scan for mappings you forgot.

Watch the gif below. In it, I simply search my mappings for one containing “strf” — I often forget which mapping I have setup toinsert a markdown header with the current date and time.

How useful was this post?

Average rating 3.8 / 5. Vote count: 198

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

61 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts

Leave a reply

Your email address will not be published. Required fields are marked *