-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto-pairs.lua
47 lines (42 loc) · 1.05 KB
/
auto-pairs.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local autocmd = require('utils').autocmd
local function config()
-- Add auto-pairs for HTML comment
autocmd('FileType', {
pattern = { 'html', 'markdown' },
callback = function()
vim.cmd("let b:AutoPairs = AutoPairsDefine({'<!--' : '-->'})")
end,
})
-- Add auto-pairs for React.Fragment
autocmd('FileType', {
pattern = { 'javascriptreact', 'typescriptreact' },
callback = function()
vim.cmd("let b:AutoPairs = AutoPairsDefine({'<>':'</>'})")
end,
})
-- Add auto-pairs for ejs
autocmd('FileType', {
pattern = 'ejs',
callback = function(ev)
vim.b[ev.buf].AutoPairs = vim.fn['AutoPairsDefine']({
['<%'] = '%>',
['<%='] = '%>',
['<%-'] = '%>',
['<%#'] = '%>',
})
end,
})
-- add auto-pairs for mdx
autocmd('FileType', {
pattern = 'markdown.mdx',
callback = function ()
-- pairs for comments
vim.cmd("let b:AutoPairs = AutoPairsDefine({'{/*':'*/}'})")
end
})
end
return {
'jiangmiao/auto-pairs',
enabled = false,
config = config,
}