diff --git a/config/default.nix b/config/default.nix index 1636eda..04e907f 100644 --- a/config/default.nix +++ b/config/default.nix @@ -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 diff --git a/config/options.nix b/config/options.nix index 61378c7..b2857ca 100644 --- a/config/options.nix +++ b/config/options.nix @@ -9,6 +9,7 @@ conceallevel = 1; updatetime=100; undofile = true; + splitright = true; # Tabs & Spaces tabstop = 2; diff --git a/config/plugins/cmp/cmp.nix b/config/plugins/cmp/cmp.nix index f5c6708..e109bb1 100644 --- a/config/plugins/cmp/cmp.nix +++ b/config/plugins/cmp/cmp.nix @@ -40,7 +40,7 @@ "" = # Lua "cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; - "" = + "" = # Lua "cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })"; }; diff --git a/config/plugins/cmp/copilot.nix b/config/plugins/cmp/copilot.nix new file mode 100644 index 0000000..49caa9d --- /dev/null +++ b/config/plugins/cmp/copilot.nix @@ -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 = "c"; + action = ""; + options = { + desc = "+copilot"; + }; + } + + { + mode = ["n"]; + key = "ce"; + action = "Copilot enable"; + options = { + silent = true; + desc = "Enable inline suggestions"; + }; + } + + { + mode = ["n"]; + key = "cd"; + action = "Copilot disable"; + options = { + silent = true; + desc = "Disable inline suggestions"; + }; + } + ]; +} diff --git a/config/plugins/utils/copilot-chat.nix b/config/plugins/utils/copilot-chat.nix new file mode 100644 index 0000000..e02b482 --- /dev/null +++ b/config/plugins/utils/copilot-chat.nix @@ -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 = "ct"; + action = "CopilotChatToggle"; + options = { + silent = true; + desc = "Toggle chat"; + }; + } + + { + mode = ["n"]; + key = "cp"; + action = "CopilotChatPrompts"; + options = { + silent = true; + desc = "Select prompt"; + }; + } + + { + mode = ["n"]; + key = "cm"; + action = "CopilotChatModels"; + options = { + silent = true; + desc = "Select model"; + }; + } + + { + mode = ["n"]; + key = "ca"; + action = "CopilotChatAgents"; + options = { + silent = true; + desc = "Select agent"; + }; + } + ]; +} diff --git a/config/plugins/utils/telescope.nix b/config/plugins/utils/telescope.nix index 1958ac4..af41389 100644 --- a/config/plugins/utils/telescope.nix +++ b/config/plugins/utils/telescope.nix @@ -8,6 +8,10 @@ fzf-native = { enable = true; }; + # Enable telescope UI select. + ui-select = { + enable = true; + }; }; # Configure telescope settings. diff --git a/flake.nix b/flake.nix index 22ea14d..a74b025 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = {