Neovim, add opencode support

This commit is contained in:
Julia Lange 2026-05-12 22:56:05 -07:00
parent 8ace9ff9b4
commit cfe5f11691
Signed by: Julia
SSH key fingerprint: SHA256:5DJcfxa5/fKCYn57dcabJa2vN2e6eT0pBerYi5SUbto

View file

@ -19,6 +19,7 @@
lualine.enable = lib.mkOption { default = true; }; lualine.enable = lib.mkOption { default = true; };
luasnip.enable = lib.mkOption { default = false; }; luasnip.enable = lib.mkOption { default = false; };
nvimcmp.enable = lib.mkOption { default = true; }; nvimcmp.enable = lib.mkOption { default = true; };
opencode.enable = lib.mkOption { default = true; };
telescope = { telescope = {
enable = lib.mkOption { default = true; }; enable = lib.mkOption { default = true; };
fzf.enable = lib.mkOption { default = true; }; fzf.enable = lib.mkOption { default = true; };
@ -83,7 +84,29 @@
# -- Easy copy and pasting to external programs # -- Easy copy and pasting to external programs
# -- map <C-y> "+yy # -- map <C-y> "+yy
# -- map <C-p> "+P # -- map <C-p> "+P
]; ] ++ lib.lists.optionals config.neovim.plugins.opencode.enable (let
ocFunc = cmd: let raw = "function() require('opencode').${cmd} end";
in (config.lib.nixvim.mkRaw raw);
in [
{
key = "<leader>ot";
action = ocFunc "toggle()";
mode = [ "n" "x" ];
options.desc = "Toggle opencode";
}
{
key = "<leader>oa";
action = ocFunc "ask('', { submit = true })";
mode = [ "n" "x" ];
options.desc = "Ask opencode...";
}
{
key = "<leader>or";
action = ocFunc "operator('@this ')";
mode = [ "n" "x" ];
options.desc = "Add range to opencode";
}
]);
}; };
programs.nixvim.colorschemes = with config.neovim.themes; { programs.nixvim.colorschemes = with config.neovim.themes; {
@ -126,6 +149,16 @@
}; };
}; };
opencode = {
enable = opencode.enable;
settings = {
input.enabled = true;
lsp.enabled = true;
events.permissions.enabled = false;
};
};
snacks.enable = opencode.enable;
telescope = { telescope = {
enable = telescope.enable; enable = telescope.enable;
keymaps = { keymaps = {