nvim-config/lua/configs/autopairs.lua

40 lines
963 B
Lua
Raw Normal View History

2022-03-01 07:49:46 +00:00
local M = {}
function M.config()
2023-01-10 18:21:09 +00:00
local status_ok, npairs = pcall(require, 'nvim-autopairs')
2022-03-01 07:49:46 +00:00
if not status_ok then
return
end
2023-01-10 18:21:09 +00:00
npairs.setup({
2022-03-01 07:49:46 +00:00
check_ts = true,
ts_config = {
2023-01-10 18:21:09 +00:00
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
2022-03-01 07:49:46 +00:00
java = false,
},
2023-01-10 18:21:09 +00:00
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
2022-03-01 07:49:46 +00:00
fast_wrap = {
2023-01-10 18:21:09 +00:00
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
2022-03-01 07:49:46 +00:00
offset = 0,
2023-01-10 18:21:09 +00:00
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
2022-03-01 07:49:46 +00:00
check_comma = true,
2023-01-10 18:21:09 +00:00
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
2022-03-01 07:49:46 +00:00
},
2023-01-10 18:21:09 +00:00
})
2022-03-01 07:49:46 +00:00
--Rule = require "nvim-autopairs.rule"
-- local cmp_autopairs = require "nvim-autopairs.completion.cmp"
-- local cmp_status_ok, cmp = pcall(require, "cmp")
-- if not cmp_status_ok then
-- return
-- end
-- cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
end
return M