When typing code, I would normally close brackets, go back inside, go outside, type semicolon, etc:
I might start with (| is the caret):
System.out.print
First and foremost, there is much speed to be gained in Vim by using h
, j
, k
and l
instead of the arrow keys. See Learning Vim the Pragmatic Way for a overview of the keys.
However, what you probably want in this case is the AutoClose plugin. It automatically inserts the closing parenthesis (or quote) along with the opening, and places the caret between them. Thus you go from
System.out.println(|)
to
System.out.println(foo(|))
to
System.out.println(foo("|"))
If you then type "))
, the caret will "move over" the closing characters instead of inserting new ones. Although, a faster way to get to the end of line is probably
.
System.out.println(foo(""));
So, to sum up, the above can be produced by typing System.out.println(foo("
.
For editing paired characters, as opposed to inserting them, see surround.vim.