artemave
artemave

Reputation: 6926

few vim autoinserts for ruby needed

I want to try the following things in vim insert mode:

I know it is possible, but my competence in this part of vim does not even reach the self-starter level.

Upvotes: 2

Views: 109

Answers (2)

Luc Hermitte
Luc Hermitte

Reputation: 32926

lh-brackets helps define brackets related mappings. It also provides a few functions aimed at defining context-sensitive mappings and abbreviations (see Map4TheseContext).

If in ruby %() is associated to a syntax highlighting, Map4TheseContext will also solve your last request. If not, you'll have to play with searchpair() to detect the current context. Let me know if you have troubles to come up with a working solution.

Upvotes: 1

mikej
mikej

Reputation: 66263

This script will do the first one (auto inserting the closing bracket and placing the cursor between the brackets.)

Upvotes: 2

Related Questions