1

I know of 4 commands I can use in Vim's insert mode.

  1. C-w delete word
  2. C-k delete line
  3. C-d delete one 'shiftwidth' worth of indent
  4. C-t add one 'shiftwidth' worth of indent
  5. C-O begin a quick command.

My results from googling have been saturated with answers on how to switch from insert mode to normal mode.

The page for :help <C-d> and the other insert mode commands is not what I'm looking for, it's always just the keystroke. How do I search for the specific commands available in insert mode? I don't know how to look it up...


More generally, how do I look up commands specific to a single mode?

  • 1
    Since you asked & answered as a community Q&A might want to generalize this to "How do I find commands that are available in a given mode?" and talk about c_, v_ and so on. – B Layer Aug 27 '18 at 17:14
3

All the documentation you're looking for can be found on the :help insert page.

Everything you're looking for will be under :help ins-special-keys section. As you can see from there, you can look up these commands using :help by prefixing the keystroke with a shorthand for the mode followed by an underscore - which is i_ in this case.

Therefore, to look up what <C-]> does in insert mode is, type :help i_CTRL-]. To look up what <C-]> does in visual mode, type :help v_CTRL-].

There is one exception to this, though. If you want to look up what a normal mode keystroke does, then you don't need to add a prefix. That's a design choice that I agree with. So just type :help CTRL-] to look up what <C-]> does in normal mode.

  • Why don't you need a n_ prefix even though you're looking up a command in normal mode? It's vim documentation's philosophy. Vim docs focused more on ~giving quick useful information to the uninitiated~ rather than being a ~comprehensively engineered guide meant to be read cover-to-cover~. This decision DOES cause a bothersome lack of orthogonality in some cases (example: this answer), and repetition in others (example: an explanation on how to use the 'backspace' option appears 4 times in insert's documentation). – Ari Sweedler Aug 27 '18 at 17:47
  • This philosophic method towards documentation lowers the learning curve for beginners at the cost of people reading documentation cover-to-cover. Which is probably the right move ;) – Ari Sweedler Aug 27 '18 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.