setup copilot inline suggestions + chat

This commit is contained in:
♥ Minnie ♥ 2025-06-11 15:32:18 +08:00
parent 7aca777bf9
commit b13e372fd6
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
7 changed files with 116 additions and 2 deletions

View file

@ -9,6 +9,7 @@
# Completion
./plugins/cmp/cmp.nix
./plugins/cmp/copilot.nix
# Debug Adapter Protocol
./plugins/dap/dap.nix
@ -39,6 +40,7 @@
./plugins/git/lazygit.nix
# Utils
./plugins/utils/copilot-chat.nix
./plugins/utils/markdown-preview.nix
./plugins/utils/render-markdown.nix
./plugins/utils/oil.nix

View file

@ -9,6 +9,7 @@
conceallevel = 1;
updatetime=100;
undofile = true;
splitright = true;
# Tabs & Spaces
tabstop = 2;

View file

@ -40,7 +40,7 @@
"<Up>" =
# Lua
"cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
"<Tab>" =
"<cr>" =
# Lua
"cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })";
};

View file

@ -0,0 +1,44 @@
{...}: {
plugins.copilot-vim = {
enable = true;
settings = {
# Disable Copilot by default.
enabled = 0;
# Use the following workspace folders to improve suggestions.
workspace_folders = [
"/home/sajenim/.repositories/personal"
];
};
};
keymaps = [
{
mode = ["n" "v"];
key = "<leader>c";
action = "<Nop>";
options = {
desc = "+copilot";
};
}
{
mode = ["n"];
key = "<leader>ce";
action = "<cmd>Copilot enable<cr>";
options = {
silent = true;
desc = "Enable inline suggestions";
};
}
{
mode = ["n"];
key = "<leader>cd";
action = "<cmd>Copilot disable<cr>";
options = {
silent = true;
desc = "Disable inline suggestions";
};
}
];
}

View file

@ -0,0 +1,59 @@
{ ... }: {
plugins.copilot-chat = {
enable = true;
# Copilot Chat settings.
settings = {
# Model to use for Copilot Chat.
model = "gpt-4.1";
# Window settings for Copilot Chat.
window = {
# Width of the chat window.
width = 0.3;
};
};
};
# Keymaps for Copilot Chat.
keymaps = [
{
mode = ["n"];
key = "<leader>ct";
action = "<cmd>CopilotChatToggle<cr>";
options = {
silent = true;
desc = "Toggle chat";
};
}
{
mode = ["n"];
key = "<leader>cp";
action = "<cmd>CopilotChatPrompts<cr>";
options = {
silent = true;
desc = "Select prompt";
};
}
{
mode = ["n"];
key = "<leader>cm";
action = "<cmd>CopilotChatModels<cr>";
options = {
silent = true;
desc = "Select model";
};
}
{
mode = ["n"];
key = "<leader>ca";
action = "<cmd>CopilotChatAgents<cr>";
options = {
silent = true;
desc = "Select agent";
};
}
];
}

View file

@ -8,6 +8,10 @@
fzf-native = {
enable = true;
};
# Enable telescope UI select.
ui-select = {
enable = true;
};
};
# Configure telescope settings.

View file

@ -25,10 +25,14 @@
system,
...
}: let
pkgsWithUnfree = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
pkgs = pkgsWithUnfree;
module = import ./config; # import the module directly
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {