I'm new to Vim bindings and I want to start using them in Sublime, but ran into a few stumbling blocks.

When I type various kinds of enclosed tokens, such as "string literals" or {code blocks} or (parens) I have developed the (good?) habit of typing the opening and closing characters, tapping back, and filling in the desired characters. I do this so I never forget closing characters.

For example, to produce "literal", I would type "" then move the cursor back 1 space, then write the word literal inside the quotes, then move the cursor 1 space forward to continue typing.

With Vim bindings, I seem to have to leave Insert mode each time I move back a space and then forward a space. Sublime has some settings that will automatically type () whenever you type ( and then place the cursor in the middle, so I guess that eliminates the need for the first move, but the problem of moving the cursor forward after typing my enclosed statement remains.

Vim users must have some good approach to this or they would all have gone mad by now. Do you guys just give up at typing the opening and closing characters first? Fancy key bindings to leave insert mode, move forward/back by 1, and then go back to insert mode (I would want this in one keypress)??

Please let me know if I'm doing this all wrong and also if you have a better title suggestion. Wasn't sure how to describe this problem.


In sublime you can edit the mappings to do something like "shift+space" to move the cursor forward one space using the following code as seen here: https://stackoverflow.com/questions/14800608/sublime-text-2-move-cursor-out-of-parenthesis-quotes-or-brackets

{ "keys": ["shift+space"], "command": "move", "args": {"by": "characters", "forward": true} }

Works fantastic for me.

Edit: This will make ctrl+shift+space move backwards one space.

{"keys": ["ctrl+shift+space"], "command": "move", "args": {"by": "characters", "forward": false} }

The combination of the two makes life much easier :)


Vim has numerous smart "auto close" plugins and it's easy to come up with your own simple mappings like inoremap () ()<Left>.

But, both in Vim and in Sublime, you can simply type () and hit <Left>. It's certainly not as embarrassing as exiting insert mode just to go back one character.

  • yes, just hitting the left arrow would be another option of course. I disabled arrow keys to force myself to use hjkl, but might revert that to make life easier here :) – fractalous Feb 20 '14 at 9:40
  • hjkl are not better than the arrows, don't let "them" brainwash you. – romainl Feb 20 '14 at 9:43

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.