mini-pairs.lua 1.8 KB

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