From 5863d0bbe1ae1042e243451a2a5a871a554c936d Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Thu, 2 Mar 2023 13:07:40 -0500 Subject: [PATCH] Updates with copilot.lua Even though the completion indent is broken... https://github.com/zbirenbaum/copilot-cmp/issues/45 copilot.vim doesn't display any virtual text either since nvim-cmp overrides it. --- lua/install-plugins.lua | 3 ++- lua/plugins/copilot-cmp.lua | 3 +++ lua/plugins/mason-lspconfig-nvim.lua | 1 - lua/plugins/nvim-cmp.lua | 12 ++++++------ lua/user/keymaps.lua | 2 ++ 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 lua/plugins/copilot-cmp.lua diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index 042e6f6..96d9714 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -336,9 +336,10 @@ return require('packer').startup(function(use) use { 'zbirenbaum/copilot-cmp', config = function () - require('copilot_cmp').setup() + require('plugins.copilot-cmp') end } + -- use 'github/copilot.vim' use 'ziglang/zig.vim' use { 'akinsho/bufferline.nvim', diff --git a/lua/plugins/copilot-cmp.lua b/lua/plugins/copilot-cmp.lua new file mode 100644 index 0000000..bb5620f --- /dev/null +++ b/lua/plugins/copilot-cmp.lua @@ -0,0 +1,3 @@ +local cmp = require('copilot_cmp') + +cmp.setup() diff --git a/lua/plugins/mason-lspconfig-nvim.lua b/lua/plugins/mason-lspconfig-nvim.lua index aa0944e..b534e7d 100644 --- a/lua/plugins/mason-lspconfig-nvim.lua +++ b/lua/plugins/mason-lspconfig-nvim.lua @@ -1,4 +1,3 @@ require('mason-lspconfig').setup({ - ensure_installed = { 'lua_ls', 'rust_analyzer', 'bashls', 'cssls', 'html', 'jsonls', 'sqls', 'taplo'}, automatic_installation = true, }) diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index d80680f..b0214b0 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -44,17 +44,17 @@ cmp.setup({ end, { "i", "s" }), }), sources = cmp.config.sources({ + { name = "copilot", priority = 100, group_index = 1 }, { name = 'nvim_lsp_signature_help', - priority = 100, - group_index = 1, + priority = 90, + group_index = 2, }, { name = 'nvim_lsp', - priority = 100, - group_index = 1, + priority = 90, + group_index = 2, }, - { name = "copilot", group_index = 2 }, { name = 'buffer', priority = 80, @@ -93,7 +93,7 @@ cmp.setup({ mode = 'symbol_text', maxwidth = 50, ellipsis_char = '…', - symbol_map = { Copilot = '🤖' }, + -- symbol_map = { Copilot = '🤖' }, }) } }) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 1668b56..96cd61b 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -37,3 +37,5 @@ vim.keymap.set('n', 's', [[SqlsExecuteQuery]], { noremap = fals vim.keymap.set('n', 'S', [[SqlsExecuteQueryVertical]], { noremap = false, silent = true, desc = "[S]qls execute query under cursor in vertical split" }) vim.keymap.set('x', 's', [[(sqls-execute-query)]], { noremap = false, silent = true, desc = "[S]qls execute selected query" }) vim.keymap.set('x', 'S', [[(sqls-execute-query-vertical)]], { noremap = false, silent = true, desc = "[S]qls execute selected query in vertical split" }) + +vim.keymap.set("n", "bo", "%bd|e#", { desc = "Close all buffers but the current one" }) -- https://stackoverflow.com/a/42071865/516188