-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
autopairs.lua
64 lines (59 loc) · 1.93 KB
/
autopairs.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
return {
'windwp/nvim-autopairs',
config = function(config)
local conf = config.autopairs
require('nvim-autopairs').setup(conf.opts)
local has_cmp, cmp = pcall(require, 'cmp')
if has_cmp then
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done(conf.confirm))
end
end,
defaultConfig = {
'autopairs',
{
opts = {
disable_filetype = { 'TelescopePrompt', 'neo-tree', 'neo-tree-popup' },
disable_in_macro = false, -- disable when recording or executing a macro
disable_in_visualblock = false, -- disable when insert after visual block mode
-- ignored_next_char = [=[[%w%%%'%[%"%.]]=],
enable_moveright = true,
enable_afterquote = true, -- add bracket pairs after quote
enable_check_bracket_line = true, --- check bracket in same line
enable_bracket_in_quote = true,
enable_abbr = false, -- trigger abbreviation
break_undo = true, -- switch for basic rule break undo sequence
check_ts = false,
map_cr = false,
map_bs = true, -- map the <BS> key
map_c_h = false, -- Map the <C-h> key to delete a pair
map_c_w = false, -- map <c-w> to delete a pair if possible
},
confirm = {
filetypes = {
-- -- "*" is a alias to all filetypes
-- ['*'] = {
-- ['('] = {
-- kind = { cmp.lsp.CompletionItemKind.Function, cmp.lsp.CompletionItemKind.Method },
-- handler = handlers['*'],
-- },
-- },
--
-- lua = {
-- ['('] = {
-- kind = { cmp.lsp.CompletionItemKind.Function, cmp.lsp.CompletionItemKind.Method },
-- ---@param char string
-- ---@param item item completion
-- ---@param bufnr buffer number
-- handler = function(char, item, bufnr)
-- -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr})
-- end,
-- },
-- },
--
-- tex = false, -- Disable for tex
},
},
},
},
}