Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I go to end of parenthesis/brackets/quotes without switching insert mode in Vim?

Tags:

vim

I'm looking for a plugin that makes you get out of parenthesis/brackets/quotes/etc when you're inside them. I find it kind of hard having to ESC to command mode and typing A to get out of the parenthesis to go to the end of the line in Insert mode, is there a plugin that meets my needs?

like image 724
rkrdo Avatar asked Jun 14 '12 16:06

rkrdo


People also ask

How do I add a bracket in Vim?

lh-brackets simply binds ( to surround the selection with the brackets. Unlike surround it doesn't follow the vim usual keybinding philosophy as does. Instead less keys are required.

How do you enter insert mode and go to the beginning of the line?

Esc + i to exit insert mode and enter it again, effectively going to the beginning of line.


2 Answers

A plugin would be overkill. Add this mapping to your ~/.vimrc:

inoremap <C-e> <C-o>A
  • <C-o> is used to issue a normal mode command without leaving insert mode.
  • A, well… you know what it does.
like image 188
romainl Avatar answered Nov 09 '22 17:11

romainl


If you install the delimitMate plugin you can achieve this with the <S-e> or <C-g>g mapping.

like image 26
Magnun Leno Avatar answered Nov 09 '22 16:11

Magnun Leno