config.nvim/lua/plugins/autopairs.lua

37 lines
1.1 KiB
Lua

return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
--
opts = {
check_ts = true,
ts_config = {
lua = { 'string' }, -- it will not add a pair on that treesitter node
javascript = { 'template_string' },
java = false, -- don't check treesitter on java
},
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
before_key = 'h',
after_key = 'l',
cursor_pos_before = true,
keys = 'qwertyuiopzxcvbnmasdfghjkl',
manual_position = true,
highlight = 'Search',
highlight_grey = 'Comment',
},
},
}