Wednesday, April 8, 2009

Insert Mode Shortcuts

Here are some handy shortcuts that you can utilize while you're in insert mode.

ctrl-t - adjust current line one indent right
ctrl-d - adjust current line one indent left
ctrl-w - backspace over a word
ctrl-u - delete to beginning of indent

6 comments:

Anonymous said...

ctrl-u deletes to the beginning of line, not indent.

Travis Whitton said...

@mariuss

If there's whitespace preceding textual characters on the line, it's retained.

Derek Wyatt said...

ctrl-o is another great one. Enter normal mode for one command and then return to insert mode.

Anonymous said...

Derek, that's an interesting one. Could you give a couple of examples of how you regularly use Ctrl-o?

Thanks.

Casey

Derek Wyatt said...

Sure...

<C-o>ma - Mark the current position and then keep typing.

<C-o>gql - Format the current line and keep typing

I tend to use it more for some home-grown mappings that I have to do specific things of my own, but the above two should give you a taste for the more general types of ideas.

The next type you do <Esc>(thing)i you might remember that you could have done that with <C-o>

Sergio said...

Ctrl-y .......... repeat line above
Ctrl-e ...........repeat line below
Ctrl-x Ctrl-l.... repeat hole line