Compare commits

...

2 commits

Author SHA1 Message Date
b13e372fd6
setup copilot inline suggestions + chat 2025-06-11 15:32:18 +08:00
7aca777bf9
update comment keybinding 2025-06-11 15:31:40 +08:00
8 changed files with 124 additions and 11 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

@ -4,19 +4,18 @@
settings = {
toggler = {
line = "<leader>cl<Return>";
block = "<leader>cb<Return>";
line = "<leader>/n";
};
opleader = {
line = "<leader>cl";
block = "<leader>cb";
line = "<leader>/l";
block = "<leader>/b";
};
extra = {
above = "<leader>c<Up>";
below = "<leader>c<Down>";
eol = "<leader>c<End>";
above = "<leader>/o";
below = "<leader>/e";
eol = "<leader>/i";
};
mappings = {
@ -27,9 +26,9 @@
};
keymaps = [
{ # prefix: comment
{
mode = ["n" "v"];
key = "<leader>c";
key = "<leader>/";
action = "<Nop>";
options = {
desc = "+comment";

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 = {