Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm transitioning to vim from another vi-like editor. I keep trying to use my old key combinations but of course vim has different mappings. How can I find out what function is mapped to the key combination I pushed? For example, I might push Ctrl-O and something happens, but I don't understand what it is, and want to learn about it.

share|improve this question
up vote 3 down vote accepted

do this:

:help ^o

Where ^o is pressing CTRL-o

share|improve this answer
1  
Typing out :help <C-o> also works, and that format will fork for any command, just type :help <key sequence> – asfallows Apr 17 '12 at 17:35
1  
:help index is also good. It lists all the keys/commands and their functions. – garyjohn Apr 17 '12 at 18:25
    
I would add that it's very important to read through the page that comes up when you just type ":help" since it introduces the user to the conventions and notations of the actual help documentation. – Heptite Apr 17 '12 at 18:52

You can identify the mapping and its source via the different map commands. For example: :verbose map <C-K>* could output something like this:

v  <C-K>       * :m-2<CR>gv=gv
        Last set from ~/.vimrc
n  <C-K>       * :m-2<CR>==
        Last set from ~/.vimrc

If you have some time to kill have a look at the Vim Tips Wiki on the topic of key mappings. Their tutorial covers all you need.

If you've got Ruby on your machine I can highly recommend the vimdb gem.

share|improve this answer

Maybe vimdb could be something for you. From the project website:

Increase the speed and amount of vim knowledge at your fingertips with precise searching of vim's items: keys (keybindings), options and commands. vimdb is aware of vim's default items, ones in your vimrc and ones in plugins

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .