mini-pairs.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233
  1. return {
  2. 'echasnovski/mini.pairs',
  3. version = false,
  4. config = function()
  5. require("mini.pairs").setup({
  6. {
  7. -- In which modes mappings from this `config` should be created
  8. modes = { insert = true, command = false, terminal = false },
  9. -- Global mappings. Each right hand side should be a pair information, a
  10. -- table with at least these fields (see more in |MiniPairs.map|):
  11. -- - <action> - one of 'open', 'close', 'closeopen'.
  12. -- - <pair> - two character string for pair to be used.
  13. -- By default pair is not inserted after `\`, quotes are not recognized by
  14. -- `<CR>`, `'` does not insert pair after a letter.
  15. -- Only parts of tables can be tweaked (others will use these defaults).
  16. mappings = {
  17. ['('] = { action = 'open', pair = '()', neigh_pattern = '[^\\].' },
  18. ['['] = { action = 'open', pair = '[]', neigh_pattern = '[^\\].' },
  19. ['{'] = { action = 'open', pair = '{}', neigh_pattern = '[^\\].' },
  20. [')'] = { action = 'close', pair = '()', neigh_pattern = '[^\\].' },
  21. [']'] = { action = 'close', pair = '[]', neigh_pattern = '[^\\].' },
  22. ['}'] = { action = 'close', pair = '{}', neigh_pattern = '[^\\].' },
  23. ['"'] = { action = 'closeopen', pair = '""', neigh_pattern = '[^\\].', register = { cr = false } },
  24. ["'"] = { action = 'closeopen', pair = "''", neigh_pattern = '[^%a\\].', register = { cr = false } },
  25. ['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '[^\\].', register = { cr = false } },
  26. },
  27. }
  28. })
  29. end
  30. }