add copilot chat

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-11-12 10:28:18 -06:00
parent 31244ea8a8
commit ec01d807a0
3 changed files with 90 additions and 0 deletions

17
flake.lock generated
View file

@ -48,6 +48,22 @@
"type": "github" "type": "github"
} }
}, },
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim": {
"flake": false,
"locked": {
"lastModified": 1730902338,
"narHash": "sha256-kM9PtMEKyMkJjSsnwSELx52Dx6Va1id92Svv7w6nVtc=",
"owner": "CopilotC-Nvim",
"repo": "CopilotChat.nvim",
"rev": "18d51754e9dc87d6b85f1e331c1fca0825384517",
"type": "github"
},
"original": {
"owner": "CopilotC-Nvim",
"repo": "CopilotChat.nvim",
"type": "github"
}
},
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": { "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -885,6 +901,7 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim", "nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim",
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim": "nvim_plugin-CopilotC-Nvim/CopilotChat.nvim",
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring", "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring",
"nvim_plugin-L3MON4D3/LuaSnip": "nvim_plugin-L3MON4D3/LuaSnip", "nvim_plugin-L3MON4D3/LuaSnip": "nvim_plugin-L3MON4D3/LuaSnip",
"nvim_plugin-MeanderingProgrammer/render-markdown.nvim": "nvim_plugin-MeanderingProgrammer/render-markdown.nvim", "nvim_plugin-MeanderingProgrammer/render-markdown.nvim": "nvim_plugin-MeanderingProgrammer/render-markdown.nvim",

View file

@ -106,6 +106,8 @@
"nvim_plugin-zbirenbaum/copilot-cmp".flake = false; "nvim_plugin-zbirenbaum/copilot-cmp".flake = false;
"nvim_plugin-zbirenbaum/copilot.lua".url = "github:zbirenbaum/copilot.lua"; "nvim_plugin-zbirenbaum/copilot.lua".url = "github:zbirenbaum/copilot.lua";
"nvim_plugin-zbirenbaum/copilot.lua".flake = false; "nvim_plugin-zbirenbaum/copilot.lua".flake = false;
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim".url = "github:CopilotC-Nvim/CopilotChat.nvim";
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim".flake = false;
# "nvim_plugin-yetone/avante.nvim".url = "github:yetone/avante.nvim"; # "nvim_plugin-yetone/avante.nvim".url = "github:yetone/avante.nvim";
# "nvim_plugin-yetone/avante.nvim".flake = false; # "nvim_plugin-yetone/avante.nvim".flake = false;
# "nvim_plugin-stevearc/dressing.nvim".url = "github:stevearc/dressing.nvim"; # "nvim_plugin-stevearc/dressing.nvim".url = "github:stevearc/dressing.nvim";
@ -203,6 +205,7 @@
rustywind rustywind
markdownlint-cli2 markdownlint-cli2
# LSPs # LSPs
python312Packages.tiktoken # needed for copilot chat
nil # nix nil # nix
lua-language-server lua-language-server
vscode-langservers-extracted # HTML/CSS/JSON/ESLint vscode-langservers-extracted # HTML/CSS/JSON/ESLint

View file

@ -26,6 +26,74 @@ return {
main = "copilot", main = "copilot",
}, },
{ "zbirenbaum/copilot-cmp", opts = {}, main = "copilot_cmp" }, { "zbirenbaum/copilot-cmp", opts = {}, main = "copilot_cmp" },
{
"CopilotC-Nvim/CopilotChat.nvim",
branch = "canary",
dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
},
opts = {
-- debug = true, -- Enable debugging
-- See Configuration section for rest
mappings = {
complete = {
insert = "",
},
},
window = {
layout = "float",
relative = "cursor",
width = 1,
height = 0.4,
row = 1,
},
},
keys = {
-- Show help actions with telescope
{
"<leader><leader>h",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.help_actions())
end,
desc = "CopilotChat - Help actions",
mode = { "n", "v", "x" },
},
-- Show prompts actions with telescope
{
"<leader><leader>p",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
end,
desc = "CopilotChat - Prompt actions",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>q",
function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
end
end,
desc = "CopilotChat - Quick chat",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>c",
function()
require("CopilotChat").toggle()
end,
desc = "CopilotChat - Toggle",
mode = { "n", "v", "x" },
},
},
-- See Commands section for default commands if you want to lazy load on them
},
}, },
config = function() config = function()
-- See `:help cmp` -- See `:help cmp`
@ -104,5 +172,7 @@ return {
{ name = "crates" }, { name = "crates" },
}, },
}) })
require("CopilotChat.integrations.cmp").setup()
end, end,
} }