integrate GitHub Copilot
This commit is contained in:
parent
40fefa86e6
commit
0d7a6429ed
5 changed files with 81 additions and 1 deletions
|
|
@ -112,7 +112,6 @@ See [CHEATSHEET](CHEATSHEET.md)
|
||||||
|
|
||||||
## Open issues/TODOs
|
## Open issues/TODOs
|
||||||
|
|
||||||
- ollama integration <https://github.com/nomnivore/ollama.nvim>
|
|
||||||
- <https://github.com/axkirillov/hbac.nvim>
|
- <https://github.com/axkirillov/hbac.nvim>
|
||||||
- solution to search-replace visual blocks
|
- solution to search-replace visual blocks
|
||||||
- PoC <https://github.com/epwalsh/obsidian.nvim>
|
- PoC <https://github.com/epwalsh/obsidian.nvim>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
|
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" },
|
"conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" },
|
||||||
|
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
|
||||||
|
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
|
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
||||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "abac76482ec3012a2b359ba956a74e2ffd33d46f" },
|
"lsp-zero.nvim": { "branch": "v3.x", "commit": "abac76482ec3012a2b359ba956a74e2ffd33d46f" },
|
||||||
|
|
|
||||||
54
lua/weeheavy/plugins/copilot.lua
Normal file
54
lua/weeheavy/plugins/copilot.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
-- Fully featured & enhanced replacement for copilot.vim complete with API for
|
||||||
|
-- interacting with Github Copilot
|
||||||
|
-- https://github.com/zbirenbaum/copilot.lua
|
||||||
|
return {
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
lazy = true,
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
local copilot = require("copilot")
|
||||||
|
copilot.setup({
|
||||||
|
panel = {
|
||||||
|
enabled = false,
|
||||||
|
auto_refresh = false,
|
||||||
|
keymap = {
|
||||||
|
jump_prev = "[[",
|
||||||
|
jump_next = "]]",
|
||||||
|
accept = "<CR>",
|
||||||
|
refresh = "gr",
|
||||||
|
open = "<M-CR>",
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
position = "bottom", -- | top | left | right
|
||||||
|
ratio = 0.4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
suggestion = {
|
||||||
|
enabled = false,
|
||||||
|
auto_trigger = false,
|
||||||
|
debounce = 75,
|
||||||
|
keymap = {
|
||||||
|
accept = "<M-l>",
|
||||||
|
accept_word = false,
|
||||||
|
accept_line = false,
|
||||||
|
next = "<M-]>",
|
||||||
|
prev = "<M-[>",
|
||||||
|
dismiss = "<C-]>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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 > 18.x
|
||||||
|
server_opts_overrides = {},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
10
lua/weeheavy/plugins/lsp/copilot-cmp.lua
Normal file
10
lua/weeheavy/plugins/lsp/copilot-cmp.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
-- transforms https://github.com/zbirenbaum/copilot.lua into a cmp source.
|
||||||
|
-- https://github.com/zbirenbaum/copilot-cmp
|
||||||
|
return {
|
||||||
|
"zbirenbaum/copilot-cmp",
|
||||||
|
lazy = false,
|
||||||
|
--event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
require("copilot_cmp").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,13 @@ return {
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
formatting = lsp_zero.cmp_format(),
|
formatting = lsp_zero.cmp_format(),
|
||||||
|
sources = {
|
||||||
|
{ name = "copilot" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
|
@ -43,6 +50,14 @@ return {
|
||||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||||
}),
|
}),
|
||||||
|
window = {
|
||||||
|
documentation = {
|
||||||
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue