diff options
| author | Vito G. Graffagnino <vito@graffagnino.xyz> | 2022-06-03 15:11:10 +0100 |
|---|---|---|
| committer | Vito G. Graffagnino <vito@graffagnino.xyz> | 2022-06-03 15:11:10 +0100 |
| commit | b8e8fccb00dafc937ab84c90fc4ad90bc982fe98 (patch) | |
| tree | 143c143587b99ddc38ca9a2eaa586e411f35aa7e | |
| parent | 06a4f3a8c25a1a7b9be9301f77a12d8c12397bb9 (diff) | |
| parent | df55cb522dfd6b3d2cd2b734fce9d8fc1303385a (diff) | |
Merge branch '09-autopairs' into vgg
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/user/autopairs.lua | 33 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 1 | ||||
| -rw-r--r-- | lua/user/treesitter.lua | 3 |
4 files changed, 38 insertions, 0 deletions
@@ -6,3 +6,4 @@ require "user.cmp" require "user.lsp" require "user.telescope" require "user.treesitter" +require "user.autopairs" diff --git a/lua/user/autopairs.lua b/lua/user/autopairs.lua new file mode 100644 index 0000000..577e571 --- /dev/null +++ b/lua/user/autopairs.lua @@ -0,0 +1,33 @@ +-- Setup nvim-cmp. +local status_ok, npairs = pcall(require, "nvim-autopairs") +if not status_ok then + return +end + +npairs.setup { + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "<M-e>", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, +} + +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 = "" } }) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index d16c0c4..65e808f 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -44,6 +44,7 @@ return packer.startup(function(use) use "wbthomason/packer.nvim" -- Have packer manage itself use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins + use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter -- Colorschemes use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index 7d45bd4..b840ccd 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -17,6 +17,9 @@ configs.setup { ensure_installed = "maintained", sync_install = false, ignore_install = { "" }, -- List of parsers to ignore installing + autopairs = { + enable = true, + }, highlight = { enable = true, -- false will disable the whole extension disable = { "" }, -- list of language that will be disabled |
