4

When I'm entering some text in vim, sometimes I need to jump to some other place and enter more text. I know there are some shortcuts with ctrl key to simplify the movement.

What are the most useful keyboard shortcuts in insert mode?

e.g.

I have:

'text_sample'

The cursor is in _ position. I want to jump to the end of line without having to press ESC and ctrl + A.

  • 1
    "most useful" or "favorite" type questions tend to be too vague for this site. I'd suggest revising your question to be more specific, e.g. "what's the fastest way to get to the end of the line in insert mode?". Also, I think you meant esc A (A = shift a), not esc ctrl a. – jw013 Dec 22 '11 at 16:23
8
  • End (1 key) the only suggestion that has fewer keystrokes than
  • Esc A (2 keys + use of shift), the one you have suggested.
  • Ctrl-o $ OR Ctrl-o A (2 keys + control and shift), the most keystrokes yet.

The last one illustrates the use of Ctrl-o in Insert mode, which lets you interrupt insert mode to use exactly one normal mode command before returning.

  • That's awesome. I never knew about ctrl-o, despite having used Vim for years. – Bill B Jan 28 '12 at 21:01
2

Does your keyboard not have an End key?

This is what I use in insert mode to jump to the end of the line. There is a Home key to jump to the beginning of the line. Also, in insert mode, pageup and pagedown move up and down the page. Otherwise, no vim movement bindings are applicable in insert mode.

(Clearly, for instance, if you type f5w, you will not go to the 5th w, but will type in the characters, "f5w", or } won't go to the next paragraph, but will just type "}", etc.)

  • 1) There are "short" keyboards without Insert/Delete/Home/End/PgUp/PgDn keys 2) It's too far away to move your hand from typing position – yahol Jul 1 '18 at 16:44
0

Here is a link that has some commands, http://www.vmunix.com/~gabor/vi.html

There aren't that many like you've described [ ctrl - ...] in insert mode

but you can read it as ^ mean type control

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.