diff options
| author | christianchiarulli <chrisatmachine@gmail.com> | 2021-12-14 17:59:55 -0500 |
|---|---|---|
| committer | christianchiarulli <chrisatmachine@gmail.com> | 2021-12-14 17:59:55 -0500 |
| commit | b9a2bc855bbd7a7d54c9e280ee875393e30cf1a6 (patch) | |
| tree | 1e83280d8d5a811ca825ca4e38790ec1bae9c6e6 /lua/user | |
| parent | 63cb259f98568820d5af6f346bff88c8eab4029b (diff) | |
add autopairs
Diffstat (limited to 'lua/user')
| -rw-r--r-- | lua/user/autopairs.lua | 33 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 1 | ||||
| -rw-r--r-- | lua/user/treesitter.lua | 3 |
3 files changed, 37 insertions, 0 deletions
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 af7dfb1..74fcb73 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 f00cc2d..b5754d6 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -7,6 +7,9 @@ configs.setup { ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) 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 |
