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

View file

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

View file

@ -40,7 +40,7 @@
"<Up>" = "<Up>" =
# Lua # Lua
"cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; "cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
"<Tab>" = "<cr>" =
# Lua # Lua
"cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })"; "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 = { settings = {
toggler = { toggler = {
line = "<leader>cl<Return>"; line = "<leader>/n";
block = "<leader>cb<Return>";
}; };
opleader = { opleader = {
line = "<leader>cl"; line = "<leader>/l";
block = "<leader>cb"; block = "<leader>/b";
}; };
extra = { extra = {
above = "<leader>c<Up>"; above = "<leader>/o";
below = "<leader>c<Down>"; below = "<leader>/e";
eol = "<leader>c<End>"; eol = "<leader>/i";
}; };
mappings = { mappings = {
@ -27,9 +26,9 @@
}; };
keymaps = [ keymaps = [
{ # prefix: comment {
mode = ["n" "v"]; mode = ["n" "v"];
key = "<leader>c"; key = "<leader>/";
action = "<Nop>"; action = "<Nop>";
options = { options = {
desc = "+comment"; 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 = { fzf-native = {
enable = true; enable = true;
}; };
# Enable telescope UI select.
ui-select = {
enable = true;
};
}; };
# Configure telescope settings. # Configure telescope settings.

View file

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