I am using latexsuite in vim and I'm trying to make MBF in insert mode expand to \mathbf{}<++> and place the cursor inside the brackets.

The following:

:call IMAP('MBF', "\\mathbf{}<++>\<Left>\<Left>\<Left>\<Left>\<Left>",'tex')

produces this:


Whereas the following

    :call IMAP('MBF', "\\mathbf{}<++><Left><Left><Left><Left><Left>",'tex')

produces this:


What am I doing wrong here? How can I write an IMAP function that puts the cursor inside the brackets after expanding MBF to \mathbf{}<++>?


You should insert a placeholder <++> where you want the cursor to be placed. In your particular example, you should use:

:call IMAP('MBF', "\\mathbf{<++>}<++>",'tex')

This produces


with the cursor inside the braces.

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.