vimauto-close

vim auto close $$ and \[\] in the insert mode?


I am using vim-latex to edit tex files and often type inline math formula by $xxxx$ and displaymath environment by \[xxxx\]. In the visual mode, Vim-latex provide shortcuts for them, i.e. `$ ,depending on characterwise or linewise selection.

How to implement auto close for them in the insert mode and let the cursor left between them? (I have used delimitMate for auto-closing, but it doesn't provide this type auto-closing.)


Solution

  • I would use Snipmate or Ultisnips for that but you can do:

    inoremap $$ $$<Left>
    inoremap \[ \[\]<Left><Left>