Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

VIM newbie here. I'm trying to write a mapping that will let me move around 'common' insertion points in a line when in insert mode. For ex. I have the delimitMate plugin - so typing a opening delimiter automatically closes the delimiter and puts me in between. once I've typed the text that goes inside, I usually want to jump to the end of the delimiter and stay in insert mode. Taking this forward, for a function like below

 $("#someid").live("someevent", function (param1, param2) {

What I'd like is a insert mode mapping that lets me jump to after the first of any of the following delimiter chars (quote, double quote, parens, and/or EOL) and cycle over these points.

Checked VIM documentation for search - the \%l operator allows to restrict over a specific line number. I tried \%.l (. being current line ) - but this doesn't work. Any ideas?

UPDATE

:exe  "/\\%" . line(".") . "l[{}()\"':=\\[\\],]"

seems to work - but doesnt move the cursor to the match.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Got this to work with the following.

inoremap <C-e> <C-o>:call search("\\%" . line(".") . "l[{}():=\\[\\]\.,]","We")<cr>

This moves the cursor to the matches on the current line, but there are two things that don't work well:

  1. there's a long pause everytime I hit the key
  2. It drops me in Ins mode before the matching character instead of after as I'd like.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.