fixed luasnip keybindings; made ai plugins an option
This commit is contained in:
parent
9cf6e96c73
commit
4ad80df1eb
7 changed files with 159 additions and 79 deletions
|
@ -3,6 +3,12 @@
|
||||||
options.nixvim-config = {
|
options.nixvim-config = {
|
||||||
enable = lib.mkEnableOption "Enable nixvim-config";
|
enable = lib.mkEnableOption "Enable nixvim-config";
|
||||||
|
|
||||||
|
enable-ai = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable ai plugins";
|
||||||
|
};
|
||||||
|
|
||||||
enable-startify = lib.mkOption {
|
enable-startify = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
|
@ -1,11 +1,49 @@
|
||||||
{ ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim.plugins.avante = {
|
programs.nixvim.plugins = if config.nixvim-config.enable-ai then {
|
||||||
|
## required dependencies
|
||||||
|
dressing.enable = true; # this is archived and may break in the future
|
||||||
|
nui.enable = true;
|
||||||
|
|
||||||
|
## optional dependencies
|
||||||
|
cmp.enable = true;
|
||||||
|
copilot-lua.enable = true;
|
||||||
|
fzf-lua.enable = true;
|
||||||
|
mini.enable = true;
|
||||||
|
telescope.enable = true;
|
||||||
|
web-devicons.enable = true;
|
||||||
|
|
||||||
|
avante = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
provider = "copilot";
|
provider = "copilot";
|
||||||
|
|
||||||
|
files = {
|
||||||
|
auto_include = true; # Automatically include relevant files
|
||||||
|
max_files = 50; # Maximum number of files to include in context
|
||||||
|
max_size_kb = 1000; # Maximum total size of files in KB
|
||||||
|
|
||||||
|
# Define which files to include/exclude
|
||||||
|
include = [
|
||||||
|
"*.lua"
|
||||||
|
"*.nix"
|
||||||
|
"*.rs"
|
||||||
|
"*.ts"
|
||||||
|
"*.js"
|
||||||
|
"*.jsx"
|
||||||
|
"*.tsx"
|
||||||
|
# Add more patterns as needed
|
||||||
|
];
|
||||||
|
|
||||||
|
exclude = [
|
||||||
|
"node_modules/**"
|
||||||
|
"dist/**"
|
||||||
|
".git/**"
|
||||||
|
# Add more patterns to exclude
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
claude = {
|
claude = {
|
||||||
api_key_name = "<api_key_name>";
|
api_key_name = "<api_key_name>";
|
||||||
};
|
};
|
||||||
|
@ -43,22 +81,39 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = {
|
## Default keybindings:
|
||||||
ask = "<leader>ca";
|
# <leader>aa - ask
|
||||||
edit = "<leader>ce";
|
# <leader>ae - edit
|
||||||
refresh = "<leader>cr";
|
# <leader>ar - refresh
|
||||||
focus = "<leader>cf";
|
# <leader>af - focus
|
||||||
toggle = {
|
# co - choose ours
|
||||||
default = "<leader>ct";
|
# ct - choose theirs
|
||||||
debug = "<leader>cd";
|
# ca - choose all theirs
|
||||||
hint = "<leader>ch";
|
# c0 - choose none
|
||||||
suggestion = "<leader>cs";
|
# cb - choose both
|
||||||
repomap = "<leader>cR";
|
# cc - choose cursor
|
||||||
};
|
# ]x - previous conflict
|
||||||
files = {
|
# [x - next conflict
|
||||||
add_current = "<leader>cc";
|
# [[ - previous code block
|
||||||
};
|
# ]] - next code block
|
||||||
};
|
|
||||||
|
# mappings = {
|
||||||
|
# ask = "<leader>ca";
|
||||||
|
# edit = "<leader>ce";
|
||||||
|
# refresh = "<leader>cr";
|
||||||
|
# focus = "<leader>cf";
|
||||||
|
# toggle = {
|
||||||
|
# default = "<leader>ct";
|
||||||
|
# debug = "<leader>cd";
|
||||||
|
# hint = "<leader>ch";
|
||||||
|
# suggestion = "<leader>cs";
|
||||||
|
# repomap = "<leader>cR";
|
||||||
|
# };
|
||||||
|
# files = {
|
||||||
|
# add_current = "<leader>cc";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} else {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins = {
|
plugins = {
|
||||||
|
@ -42,6 +42,19 @@
|
||||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||||
keywordLength = 3;
|
keywordLength = 3;
|
||||||
}
|
}
|
||||||
|
] ++ (if config.nixvim-config.enable-ai then [
|
||||||
|
{ name = "codecompanion"; }
|
||||||
|
{ name = "copilot"; }
|
||||||
|
] else []) ++ [
|
||||||
|
{
|
||||||
|
name = "path"; # file system paths
|
||||||
|
keywordLength = 3;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "luasnip"; # snippets
|
||||||
|
keywordLength = 3;
|
||||||
|
}
|
||||||
|
{ name = "cmdline"; }
|
||||||
{ name = "codecompanion"; }
|
{ name = "codecompanion"; }
|
||||||
{ name = "copilot"; }
|
{ name = "copilot"; }
|
||||||
{
|
{
|
||||||
|
@ -157,6 +170,7 @@
|
||||||
"<S-Tab>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
"<S-Tab>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
||||||
"<C-l>" = ''
|
"<C-l>" = ''
|
||||||
cmp.mapping(function()
|
cmp.mapping(function()
|
||||||
|
local luasnip = require('luasnip')
|
||||||
if luasnip.expand_or_locally_jumpable() then
|
if luasnip.expand_or_locally_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
end
|
end
|
||||||
|
@ -164,6 +178,7 @@
|
||||||
'';
|
'';
|
||||||
"<C-h>" = ''
|
"<C-h>" = ''
|
||||||
cmp.mapping(function()
|
cmp.mapping(function()
|
||||||
|
local luasnip = require('luasnip')
|
||||||
if luasnip.locally_jumpable(-1) then
|
if luasnip.locally_jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
keymaps = [
|
keymaps = if config.nixvim-config.enable-ai then [
|
||||||
{
|
{
|
||||||
mode = [ "n" ];
|
mode = [ "n" ];
|
||||||
key = "<c-c>";
|
key = "<c-c>";
|
||||||
|
@ -12,10 +12,10 @@
|
||||||
key = ",c";
|
key = ",c";
|
||||||
action = ":CodeCompanionChat Toggle<CR>";
|
action = ":CodeCompanionChat Toggle<CR>";
|
||||||
}
|
}
|
||||||
];
|
] else [];
|
||||||
|
|
||||||
plugins.codecompanion = {
|
plugins.codecompanion = {
|
||||||
enable = true;
|
enable = config.nixvim-config.enable-ai;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
adapters = {
|
adapters = {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.copilot-lua = {
|
plugins.copilot-lua = {
|
||||||
enable = true;
|
enable = config.nixvim-config.enable-ai;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
suggestion.enabled = false;
|
suggestion.enabled = false;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
programs.nixvim.plugins = {
|
programs.nixvim.plugins = {
|
||||||
comment.enable = true;
|
comment.enable = true;
|
||||||
|
## needed by avante. already archived, so may need to migrate to snacks
|
||||||
|
dressing.enable = true;
|
||||||
fugitive.enable = true;
|
fugitive.enable = true;
|
||||||
gitsigns.enable = true;
|
gitsigns.enable = true;
|
||||||
lightline.enable = false;
|
lightline.enable = false;
|
||||||
|
@ -40,6 +42,8 @@
|
||||||
top_down = false;
|
top_down = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
## needed by avante.
|
||||||
|
nui.enable = true;
|
||||||
nvim-autopairs.enable = true;
|
nvim-autopairs.enable = true;
|
||||||
nvim-bqf.enable = true;
|
nvim-bqf.enable = true;
|
||||||
nvim-lightbulb.enable = true;
|
nvim-lightbulb.enable = true;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
# keymaps = [
|
keymaps = [
|
||||||
# {
|
{
|
||||||
# mode = "i";
|
mode = "i";
|
||||||
# key = "<c-c>";
|
key = "<c-b>";
|
||||||
# action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
|
action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
|
||||||
# options.desc = "Search";
|
options.desc = "Search";
|
||||||
# }
|
}
|
||||||
# ];
|
];
|
||||||
|
|
||||||
plugins.luasnip = {
|
plugins.luasnip = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -25,16 +25,16 @@
|
||||||
updateevents = ["TextChanged" "TextChangedI"];
|
updateevents = ["TextChanged" "TextChangedI"];
|
||||||
region_check_events = "CursorHold";
|
region_check_events = "CursorHold";
|
||||||
delete_check_events = "InsertLeave";
|
delete_check_events = "InsertLeave";
|
||||||
# ext_opts.__raw = ''
|
ext_opts.__raw = ''
|
||||||
# {
|
{
|
||||||
# [require('luasnip.util.types').choiceNode] = {
|
[require('luasnip.util.types').choiceNode] = {
|
||||||
# active = {
|
active = {
|
||||||
# virt_text = { { 'choice <c-c>', 'Comment' } },
|
virt_text = { { 'choice <c-b>', 'Comment' } },
|
||||||
# hl_mode = 'combine',
|
hl_mode = 'combine',
|
||||||
# },
|
},
|
||||||
# },
|
},
|
||||||
# }
|
}
|
||||||
# '';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue