nvim/lua/plugins/autopairs.lua

29 lines
1 KiB
Lua

-- Phase 6.5: nvim-autopairs for auto-closing brackets, quotes, etc.
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = function()
local autopairs = require('nvim-autopairs')
autopairs.setup({
check_ts = true, -- Use treesitter to check for valid pair
ts_config = {
lua = { 'string' }, -- Don't add pairs in lua string treesitter nodes
javascript = { 'template_string' }, -- Don't add pairs in JS template strings
php = { 'string' }, -- Don't add pairs in PHP strings
},
disable_filetype = { 'TelescopePrompt', 'vim' },
fast_wrap = {
map = '<M-e>', -- Alt+e for fast wrap
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'Search',
highlight_grey = 'Comment',
},
})
end,
}