39 lines
1.1 KiB
Lua
39 lines
1.1 KiB
Lua
|
-- Install and configure nvim-autopairs
|
||
|
-- https://github.com/windwp/nvim-autopairs
|
||
|
|
||
|
return {
|
||
|
"windwp/nvim-autopairs",
|
||
|
event = { "InsertEnter" },
|
||
|
dependencies = {
|
||
|
"hrsh7th/nvim-cmp",
|
||
|
},
|
||
|
config = function()
|
||
|
-- Import nvim-autopairs
|
||
|
local autopairs = require("nvim-autopairs")
|
||
|
|
||
|
-- Configure autopairs
|
||
|
autopairs.setup({
|
||
|
-- Enable treesitter
|
||
|
check_ts = true,
|
||
|
disable_filetype = { "TelescopePrompt" },
|
||
|
ts_config = {
|
||
|
-- Don't add pairs in lua string treesitter nodes
|
||
|
lua = { "string" },
|
||
|
-- Don't add pairs in javscript template_string treesitter nodes
|
||
|
javascript = { "template_string" },
|
||
|
-- don't check treesitter on java
|
||
|
java = false,
|
||
|
},
|
||
|
})
|
||
|
|
||
|
-- Import nvim-autopairs completion functionality
|
||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||
|
|
||
|
-- Import nvim-cmp plugin (completions plugin)
|
||
|
local cmp = require("cmp")
|
||
|
|
||
|
-- Make autopairs and completion work together
|
||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||
|
end,
|
||
|
}
|