diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 77a53ba..17a3aec 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -3,6 +3,7 @@ "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" }, + "blink-copilot": { "branch": "main", "commit": "41e91a659bd9b8cba9ba2ea68a69b52ba5a9ebd8" }, "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/plugins/llm.lua index 38a90ba..7d90eaa 100644 --- a/nvim/.config/nvim/lua/plugins/llm.lua +++ b/nvim/.config/nvim/lua/plugins/llm.lua @@ -2,22 +2,79 @@ return { { -- NOTE: Requires manual auth with ':Copilot auth' or 'GH_COPILOT_TOKEN' set as envvar "zbirenbaum/copilot.lua", - dependencies = { "AndreM222/copilot-lualine" }, + dependencies = { + "AndreM222/copilot-lualine", + { -- show completions in blink + "saghen/blink.cmp", + optional = true, + dependencies = { + { + "fang2hou/blink-copilot", + opts = { + auto_refresh = { + backward = false, + forward = false, + }, + }, + }, + }, + opts = { + sources = { + default = { "copilot" }, + providers = { + copilot = { + name = "copilot", + module = "blink-copilot", + score_offset = 100, + async = true, + }, + }, + }, + }, + }, + }, cmd = "Copilot", - event = "InsertEnter", + event = { "InsertEnter", "VeryLazy" }, opts = { panel = { layout = { position = "bottom" } }, suggestion = { keymap = { accept = "" } }, + logger = { print_log_level = vim.log.levels.ERROR }, }, + config = function(_, opts) + require("copilot").setup(opts) + -- TODO: See also https://github.com/zbirenbaum/copilot.lua/issues/302 for potential + -- better solutions. + -- TODO: also Find way of having a 'toggle' for mapping below. + -- Current copilot.lua exposed 'toggle' command does NOT do the same. + require("copilot.command").disable() + end, keys = { { - "ap", + "aC", function() - -- FIXME: If opening before lazy-loaded, errors + require("copilot.panel").setup() require("copilot.panel").open({}) require("copilot.panel").refresh() end, - desc = "Refresh Copilot Panel", + desc = "Open copilot panel", + silent = true, + mode = { "n" }, + }, + { + "ap", + function() + require("copilot.command").enable() + end, + desc = "Enable copilot", + silent = true, + mode = { "n" }, + }, + { + "aP", + function() + require("copilot.command").disable() + end, + desc = "Disable copilot", silent = true, mode = { "n" }, },