diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 1a07b89..17fcaa1 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -35,6 +35,7 @@ with final.pkgs.lib; let # nvim-cmp (autocompletion) and extensions nvim-cmp # https://github.com/hrsh7th/nvim-cmp + nvim-autopairs # Automatically create closing brackets | https://github.com/windwp/nvim-autopairs cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/ lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/ cmp-nvim-lsp # LSP as completion source | https://github.com/hrsh7th/cmp-nvim-lsp/ diff --git a/nvim/plugin/completion.lua b/nvim/plugin/completion.lua index affb06b..05eec62 100644 --- a/nvim/plugin/completion.lua +++ b/nvim/plugin/completion.lua @@ -4,6 +4,7 @@ end vim.g.did_load_completion_plugin = true local cmp = require('cmp') +local cmp_autopairs = require('nvim-autopairs.completion.cmp') local lspkind = require('lspkind') local luasnip = require('luasnip') @@ -31,10 +32,12 @@ cmp.setup { }, formatting = { format = lspkind.cmp_format { - mode = 'symbol_text', + -- mode = 'symbol_text', + mode = 'symbol', with_text = true, maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + -- show_labelDetails = true, -- show labelDetails in menu. Disabled by default menu = { buffer = '[BUF]', @@ -52,6 +55,10 @@ cmp.setup { require('luasnip').lsp_expand(args.body) -- For `luasnip` users. end, }, + -- cmp.event:on( + -- 'confirm_done', + -- cmp_autopairs.on_confirm_done() + -- ), mapping = { [''] = cmp.mapping(function(_) if cmp.visible() then diff --git a/nvim/plugin/plugins.lua b/nvim/plugin/plugins.lua index d1943b9..f792f14 100644 --- a/nvim/plugin/plugins.lua +++ b/nvim/plugin/plugins.lua @@ -6,6 +6,7 @@ vim.g.did_load_plugins_plugin = true -- many plugins annoyingly require a call to a 'setup' function to be loaded, -- even with default configs +require("nvim-autopairs").setup {} require("dapui").setup() -- require("copilot_cmp").setup() require('nvim-surround').setup()