1

Unlike the other questions I found so far, I am aware of the role of the placeholders and actively using the features of vim-latex. However I'm finding it hard to find help customizing them. One feature that gets in my way very often is the automated replacement of {} to {}<++> (and similarly for () etc.) with the cursor placed between the brackets. I often need to type an empty bracket pair for a macro and it is very distracting to remember to use Ctrl+J every time instead of writing in a linear fashion. I am sure I will never want to type {} to fill in the contents and jump out later, it's always a deliberate empty pair that's meant to stay empty.

How can I selectively disable this mapping? I have tried

call IMAP('{}', '{}', "tex")

but this, albeit solving the problem as stated, creates a new one by inducing an unwanted delay at typing the opening bracket, which is even worse.

3
  • Not sure, but can you not simply add iunmap <buffer> {} to your after/ftplugin/tex.vim ?
    – marsupilam
    Jun 6 '17 at 14:21
  • @marsupilam Thanks! I just tried and it leads to "No such mapping".
    – The Vee
    Jun 6 '17 at 14:22
  • Right, that's because of the special IMAP function defined by the plugin (I don't know the first thing about vim-latex). Looking at the plugin's code in vim-latex/plugin/imaps.vim, I see there also is an IUNMAP function : " IUNMAP: Removes a "fake" insert mode mapping. function! IUNMAP(lhs, ft) Conclusion I would try call IUNMAP('{}',"tex") in the same after file.
    – marsupilam
    Jun 6 '17 at 14:32
1

I completely forgot that I left this question open. I found a complete solution in the meantime. The command IUNMAP, as suggested in a comment by marsupilam, does what I want exactly, without the heavy implications of disabling more general blocks of features:

[~.vim/after/ftplugin/tex.vim]

...
call IUNMAP('{}', 'tex')
...

According to this post, the command was still a rather recent addition to Latex-Suite at the time of posting my question and marsupilam's proposition did not work for me, which is why I did not close the question earlier.

0

Set this in your command prompt (:)

let g:Imap_UsePlaceHolders = 0

You can find more information in this link

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.