From bf693f4ae3d508a4d0afd604730a81cc32f3b002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Doma=C5=84ski?= Date: Wed, 21 Aug 2024 14:18:36 +0200 Subject: [PATCH] [nvim] migrate from copilot to codeium --- .config/nvim/lazy-lock.json | 2 +- .config/nvim/lua/config/keymaps.lua | 24 +++++++---- .config/nvim/lua/plugins/copilot.lua | 63 ++++++---------------------- .config/nvim/lua/plugins/ui.lua | 14 +++---- 4 files changed, 36 insertions(+), 67 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index da2d821..12778b8 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -3,7 +3,7 @@ "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, + "codeium.vim": { "branch": "main", "commit": "0b74f274b82c00eaad4b5b5cd8b2e76f872d19f1" }, "dressing.nvim": { "branch": "master", "commit": "e3714c8049b2243e792492c4149e4cc395c68eb9" }, "flutter-tools.nvim": { "branch": "main", "commit": "990a1349c29f7d474a0cd51355aba773ccc9deea" }, "gitsigns.nvim": { "branch": "main", "commit": "4a143f13e122ab91abdc88f89eefbe70a4858a56" }, diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 1269077..263242f 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -1,5 +1,5 @@ -vim.api.nvim_set_keymap("n", ";", "bprev", { desc="prev buffer", noremap = true, silent = true }) -vim.api.nvim_set_keymap("n", "'", "bnext", { desc="next buffer", noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", ";", "bprev", { desc = "prev buffer", noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "'", "bnext", { desc = "next buffer", noremap = true, silent = true }) vim.api.nvim_set_keymap("x", "", '"_dP', { noremap = true, silent = true }) vim.api.nvim_set_keymap("n", "/", "gcc", { noremap = false, silent = true }) vim.api.nvim_set_keymap( @@ -47,7 +47,7 @@ vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev se vim.keymap.set("n", "K", "norm! K", { desc = "Keywordprg" }) -- lazy -vim.keymap.set("n", "l", "Lazy", { desc = "Lazy" }) +vim.keymap.set("n", "p", "Lazy", { desc = "Lazy" }) -- new file vim.keymap.set("n", "n", "enew", { desc = "New File" }) @@ -72,8 +72,10 @@ vim.keymap.set("t", "", "close", { desc = "Hide Terminal" }) -- lsp vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", { desc = "Goto Definition" }) -vim.keymap.set("n", "gs", "vsplit | lua vim.lsp.buf.definition()", { desc = "Goto Definition in vertical split" }) -vim.keymap.set("n", "gS", "belowright | lua vim.lsp.buf.definition()", { desc = "Goto Definition in horizontal split" }) +vim.keymap.set("n", "gs", "vsplit | lua vim.lsp.buf.definition()", + { desc = "Goto Definition in vertical split" }) +vim.keymap.set("n", "gS", "belowright | lua vim.lsp.buf.definition()", + { desc = "Goto Definition in horizontal split" }) vim.keymap.set("n", "gD", "lua vim.lsp.buf.declaration()", { desc = "Goto Declaration" }) vim.keymap.set("n", "gi", "lua vim.lsp.buf.implementation()", { desc = "Goto Implementation" }) vim.keymap.set("n", "gr", "lua vim.lsp.buf.references()", { desc = "Goto References" }) @@ -87,8 +89,10 @@ vim.keymap.set("n", "lr", "lua vim.lsp.buf.rename()", { desc = -- trouble vim.keymap.set("n", "xx", "TroubleToggle", { desc = "Trouble toggle" }) -vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", { desc = "Trouble workspace diagnostics" }) -vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", { desc = "Trouble document diagnostics" }) +vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", + { desc = "Trouble workspace diagnostics" }) +vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", + { desc = "Trouble document diagnostics" }) vim.keymap.set("n", "xq", "TroubleToggle quickfix", { desc = "Trouble quickfix" }) vim.keymap.set("n", "xl", "TroubleToggle loclist", { desc = "Trouble loclist" }) vim.keymap.set("n", "gR", "TroubleToggle lsp_references", { desc = "Trouble lsp references" }) @@ -102,8 +106,10 @@ vim.keymap.set('n', 'uu', vim.cmd.UndotreeToggle, { desc = "Toggle undo -- harpoon vim.keymap.set("n", "hh", "lua require('harpoon.ui').toggle_quick_menu()", { desc = "Harpoon Menu" }) vim.keymap.set("n", "ha", "lua require('harpoon.mark').add_file()", { desc = "Harpoon Add File" }) -vim.keymap.set("n", "k", "lua require('harpoon.ui').nav_next()", { desc = "Navigate to next harpoon file" }) -vim.keymap.set("n", "j", "lua require('harpoon.ui').nav_prev()", { desc = "Navigate to previous harpoon file" }) +vim.keymap.set("n", "k", "lua require('harpoon.ui').nav_next()", + { desc = "Navigate to next harpoon file" }) +vim.keymap.set("n", "j", "lua require('harpoon.ui').nav_prev()", + { desc = "Navigate to previous harpoon file" }) -- ditto vim.keymap.set("n", "dd", "ToggleDitto", { desc = "Ditto toggle" }) diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua index 47f4d92..5c327f8 100644 --- a/.config/nvim/lua/plugins/copilot.lua +++ b/.config/nvim/lua/plugins/copilot.lua @@ -1,52 +1,15 @@ return { - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - event = "InsertEnter", - config = function() - require("copilot").setup({ - panel = { - enabled = true, - auto_refresh = false, - keymap = { - jump_prev = "[[", - jump_next = "]]", - accept = "", - refresh = "", - open = "", - }, - layout = { - position = "bottom", -- | top | left | right - ratio = 0.4, - }, - }, - suggestion = { - enabled = true, - auto_trigger = true, - debounce = 80, - keymap = { - accept = "", - accept_word = false, - accept_line = false, - next = "", - prev = "", - dismiss = "", - }, - }, - filetypes = { - yaml = false, - markdown = false, - help = false, - gitcommit = false, - gitrebase = false, - hgcommit = false, - svn = false, - cvs = false, - ["."] = false, - }, - copilot_node_command = "node", -- Node.js version must be > 16.x - server_opts_overrides = {}, - }) - end, - }, + { + 'Exafunction/codeium.vim', + event = 'BufEnter', + config = function() + -- Change '' here to any keycode you like. + vim.keymap.set('i', '', function() return vim.fn['codeium#Accept']() end, { expr = true, silent = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](1) end, + { expr = true, silent = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](-1) end, + { expr = true, silent = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true }) + end + } } diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua index ac525b5..7b0b69e 100644 --- a/.config/nvim/lua/plugins/ui.lua +++ b/.config/nvim/lua/plugins/ui.lua @@ -53,9 +53,9 @@ return { lualine_x = { { function() return " " .. require("dap").status() end, - cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, + cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, }, - { require("lazy.status").updates, cond = require("lazy.status").has_updates}, + { require("lazy.status").updates, cond = require("lazy.status").has_updates }, { "diff", symbols = { @@ -66,7 +66,7 @@ return { }, }, lualine_y = { - { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "progress", separator = " ", padding = { left = 1, right = 0 } }, { "location", padding = { left = 0, right = 1 } }, }, lualine_z = { @@ -81,7 +81,7 @@ return { }, { "lukas-reineke/indent-blankline.nvim", - lazy=false, + lazy = false, }, { "echasnovski/mini.indentscope", @@ -116,7 +116,7 @@ return { "akinsho/bufferline.nvim", event = "VeryLazy", keys = { - { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, + { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, }, opts = { @@ -129,7 +129,7 @@ return { always_show_bufferline = false, diagnostics_indicator = function(_, _, diag) local ret = (diag.error and " " .. diag.error or "") - .. (diag.warning and " " .. diag.warning or "") + .. (diag.warning and " " .. diag.warning or "") return vim.trim(ret) end, offsets = { @@ -188,7 +188,7 @@ return { dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify", - } + } }, -- icons { "nvim-tree/nvim-web-devicons", lazy = true },