is there some way to tell VIM place the cursor at some position after abbreviation expansion?
Say you have something like this in .gvimrc
iabberv <? <?=|?>
and you want to place cursor where pipe character is automatically.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A quick solution that I’d use in this case is to insert some key presses to the abbreviation:
Would place the cursor two places left, after the
=.In this manner, you can use various movement keys such as
<End>,<Home>, or even return to normal mode with<Esc>and command usual normal-mode commands. The example would then beand it does the same as the first example. If you expand an abbreviation with space, it will have one extra space.
which you can get rid of by using aOr expand with<BS>(backspace) in the abbreviation.<C-]>which will leave no space.Correction: since the abbreviation is first expanded, and after that the space inserted, you need a small function found in the help (map.txt):
This is best put in
.vimrc. Now the following abbreviation will work fully as intented:It is a bit messy, but has an external function call that removes the white space and it should work well.