I use multi cursor plugin and auto pairs together, unfortunately I find my old two plugins don’t integrate well. This autopairs from LunarWatcher often throw error: E117: Unknown function: AutoPairsTryInit when end editing with [multi cursor plugin]((https://github.com/mg979/vim-visual-multi). Although this plugin is already improved to be more compatible with vim-visual-multi. To be mentioned, this bug is fixed in this issue. I still find the bug occur.

Another auto pair plugins

I google a solution, and finally end up with this Neovim plugins nvim-autopairs. Surprisingly, it is feature richer than this autopairs plugins, unfortunately, it only support Neovim.

Other than basic function, you can extend its auto pairs rule by calling its rule method: (example from its repo)

local Rule = require('nvim-autopairs.rule')
npairs.add_rules({
  Rule("$", "$",{"tex", "latex"})
    -- don't add a pair if the next character is %
    :with_pair(cond.not_after_regex("%%"))
    -- don't add a pair if  the previous character is xxx
    :with_pair(cond.not_before_regex("xxx", 3))
    -- don't move right when repeat character
    :with_move(cond.none())
    -- don't delete if the next character is xx
    :with_del(cond.not_after_regex("xx"))
    -- disable adding a newline when you press <cr>
    :with_cr(cond.none())
  },
  -- disable for .vim files, but it work for another filetypes
  Rule("a","a","-vim")
)

Their already have some common rule that provided by its wiki. One of the very helpful rule is auto addspace on =.

var| 
insert =
var = |
insert = again
var == |

Also the plugin provide api for you to disable it per filetype. If you writing shell script you don’t auto addspace on =, you can diable it by:

local Rule = require('nvim-autopairs.rule')
npairs.add_rules({
      Rule("=", "", "-sh")
          --rule body
})

You can write your own rule to fullfill your need. Most importantly, it won’t throw error if use with vim-visual-multi!