Search code examples
vimvim-plugin

Autoclose Vim plugin – disable “{{”→“{\n\n}” functionality


How can I disable permanently the following functionality of the autoclose plugin in Vim?

When you press {{, it results in:

{


}

I want it to instead result in {{ }}.


Solution

  • You can disable autocompleting { by

    let g:AutoClosePairs_del = "{"
    

    in your ~/.vimrc. It is also being noted in the manual that g:AutoClosePairs can not be set. More details at :help ac_charstoclose.

    After disabling, you can map your own keys now, for example

    nnoremap {{ {}<Left>
    

    But I would have personally preferred { to autocomplete and Ctrl + v followed by { to escape auto-completion.