Created
May 8, 2023 18:45
-
-
Save ianchesal/93ba7897f81618ca79af01bc413d0713 to your computer and use it in GitHub Desktop.
copilot.lua + copilot-cmp in NvChad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Add the following in your custom/configs/overrides.lua file. You can configure copilot to meet your needs here. | |
M.copilot = { | |
-- Possible configurable fields can be found on: | |
-- https://github.com/zbirenbaum/copilot.lua#setup-and-configuration | |
suggestion = { | |
enable = false, | |
}, | |
panel = { | |
enable = false, | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Add the following blocks in to your custom/plugins.lua file to install the plugins | |
local plugings = { | |
-- ... all your other plugins ... | |
{ | |
"zbirenbaum/copilot.lua", | |
event = "InsertEnter", | |
opts = overrides.copilot, | |
}, | |
{ | |
"hrsh7th/nvim-cmp", | |
dependencies = { | |
{ | |
"zbirenbaum/copilot-cmp", | |
config = function() | |
require("copilot_cmp").setup() | |
end, | |
}, | |
}, | |
opts = { | |
sources = { | |
{ name = "nvim_lsp", group_index = 2 }, | |
{ name = "copilot", group_index = 2 }, | |
{ name = "luasnip", group_index = 2 }, | |
{ name = "buffer", group_index = 2 }, | |
{ name = "nvim_lua", group_index = 2 }, | |
{ name = "path", group_index = 2 }, | |
}, | |
}, | |
}, | |
} |
Based on the example provided by ianchesal, my changes are reflected in the URL (https://gist.github.com/AlanJui/f4e0a699e7dec4374030f1848f750a3d).
After testing, it's functional. Those interested can refer to it. However, when referencing, please note that due to personal workflow preferences, I've made some modifications to the shortcut key settings in the suggestions compared to the defaults in copilot.lua.
參考 ianchesal 提供的範例,我的變更如 URL 網址 (https://gist.github.com/AlanJui/f4e0a699e7dec4374030f1848f750a3d) 所示。
經測試過,基本可用。有需要的朋友可參考看看。但在引用時需請注意,基於個人的操作習性,對於 suggestion 中的快捷鍵設定,我做了一些不同於 copilot.lua 預設的變更。
在此對 ianchesal 先生,致上萬分的感謝!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ahmetkca I dropped NvChad and am using LazyVim now. At the time that I wrote this, this was fine and wouldn't cause any issues. If it causes issues now, you'll likely need to find another solution as I haven't kept this up-to-date with NvChad changes.