mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +00:00
first test
This commit is contained in:
parent
dee0bfd98e
commit
3656f9f6c5
25 changed files with 789 additions and 211 deletions
325
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
325
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
|
@ -0,0 +1,325 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.types) int str enum nullOr attrs bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.assistant = {
|
||||
avante-nvim = {
|
||||
enable = mkEnableOption "complementary Neovim plugin for avante.nvim";
|
||||
setupOpts = mkPluginSetupOption "avante-nvim" {
|
||||
provider = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "The provider used in Aider mode or in the planning phase of Cursor Planning Mode.";
|
||||
};
|
||||
|
||||
vendors = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define Your Custom providers.";
|
||||
example = literalMD ''
|
||||
```nix
|
||||
ollama = {
|
||||
__inherited_from = "openai";
|
||||
api_key_name = "";
|
||||
endpoint = "http://127.0.0.1:11434/v1";
|
||||
model = "qwen2.5u-coder:7b";
|
||||
max_tokens = 4096;
|
||||
disable_tools = true;
|
||||
};
|
||||
ollama_ds = {
|
||||
__inherited_from = "openai";
|
||||
api_key_name = "";
|
||||
endpoint = "http://127.0.0.1:11434/v1";
|
||||
model = "deepseek-r1u:7b";
|
||||
max_tokens = 4096;
|
||||
disable_tools = true;
|
||||
};
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
auto_suggestions_provider = mkOption {
|
||||
type = str;
|
||||
default = "claude";
|
||||
description = ''
|
||||
Since auto-suggestions are a high-frequency operation and therefore expensive,
|
||||
currently designating it as `copilot` provider is dangerous because:
|
||||
https://github.com/yetone/avante.nvim/issues/1048
|
||||
Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
||||
'';
|
||||
};
|
||||
|
||||
cursor_applying_provider = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The provider used in the applying phase of Cursor Planning Mode, defaults to `nil`,
|
||||
Config.provider will be used as the provider for the applying phase when `nil`.
|
||||
'';
|
||||
};
|
||||
|
||||
dual_boost = {
|
||||
enabled = mkEnableOption "dual_boost mode.";
|
||||
|
||||
first_provider = mkOption {
|
||||
type = str;
|
||||
default = "openai";
|
||||
description = "The first provider to generate response.";
|
||||
};
|
||||
|
||||
second_provider = mkOption {
|
||||
type = str;
|
||||
default = "claude";
|
||||
description = "The second provider to generate response.";
|
||||
};
|
||||
|
||||
prompt = mkOption {
|
||||
type = str;
|
||||
default = ''
|
||||
Based on the two reference outputs below, generate a response that incorporates
|
||||
elements from both but reflects your own judgment and unique perspective.
|
||||
Do not provide any explanation, just give the response directly. Reference Output 1:
|
||||
[{{provider1_output}}], Reference Output 2: [{{provider2_output}}'';
|
||||
description = "The prompt to generate response based on the two reference outputs.";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = int;
|
||||
default = 60000;
|
||||
description = "Timeout in milliseconds.";
|
||||
};
|
||||
};
|
||||
|
||||
behaviour = {
|
||||
auto_suggestions =
|
||||
mkEnableOption "auto suggestions.";
|
||||
|
||||
auto_set_highlight_group =
|
||||
mkEnableOption "automatically set the highlight group for the current line."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
auto_set_keymaps =
|
||||
mkEnableOption "automatically set the keymap for the current line."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
auto_apply_diff_after_generation =
|
||||
mkEnableOption "automatically apply diff after LLM response.";
|
||||
|
||||
support_paste_from_clipboard = mkEnableOption ''
|
||||
pasting image from clipboard.
|
||||
This will be determined automatically based whether img-clip is available or not.
|
||||
'';
|
||||
|
||||
minimize_diff =
|
||||
mkEnableOption "remove unchanged lines when applying a code block."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enable_token_counting =
|
||||
mkEnableOption "token counting."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enable_cursor_planning_mode =
|
||||
mkEnableOption "Cursor Planning Mode.";
|
||||
|
||||
enable_claude_text_editor_tool_mode =
|
||||
mkEnableOption "Claude Text Editor Tool Mode.";
|
||||
};
|
||||
|
||||
mappings = {
|
||||
diff = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for diff.";
|
||||
};
|
||||
|
||||
suggestion = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for suggestion actions.";
|
||||
};
|
||||
|
||||
jump = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for jump actions.";
|
||||
};
|
||||
|
||||
submit = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for submit actions.";
|
||||
};
|
||||
|
||||
cancel = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for cancel actions.";
|
||||
};
|
||||
|
||||
sidebar = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for sidebar actions.";
|
||||
};
|
||||
};
|
||||
|
||||
hints.enabled =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable hints.
|
||||
'';
|
||||
};
|
||||
|
||||
windows = {
|
||||
position = mkOption {
|
||||
type = enum ["right" "left" "top" "bottom"];
|
||||
default = "right";
|
||||
description = "The position of the sidebar.";
|
||||
};
|
||||
|
||||
wrap =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
similar to vim.o.wrap.
|
||||
'';
|
||||
};
|
||||
|
||||
width = mkOption {
|
||||
type = int;
|
||||
default = 30;
|
||||
description = "Default % based on available width.";
|
||||
};
|
||||
|
||||
sidebar_header = {
|
||||
enabled = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "enable/disable the header.";
|
||||
};
|
||||
|
||||
align = mkOption {
|
||||
type = enum ["right" "center" "left"];
|
||||
default = "center";
|
||||
description = "Position of the title.";
|
||||
};
|
||||
|
||||
rounded = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable rounded sidebar header";
|
||||
};
|
||||
};
|
||||
|
||||
input = {
|
||||
prefix = mkOption {
|
||||
type = str;
|
||||
default = "> ";
|
||||
description = "The prefix used on the user input.";
|
||||
};
|
||||
|
||||
height = mkOption {
|
||||
type = int;
|
||||
default = 8;
|
||||
description = ''
|
||||
Height of the input window in vertical layout.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
edit = {
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = "rounded";
|
||||
description = "The border type on the edit window.";
|
||||
};
|
||||
|
||||
start_insert = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Start insert mode when opening the edit window.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
ask = {
|
||||
floating = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open the 'AvanteAsk' prompt in a floating window.
|
||||
'';
|
||||
};
|
||||
|
||||
start_insert = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Start insert mode when opening the ask window.
|
||||
'';
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = "rounded";
|
||||
description = "The border type on the ask window.";
|
||||
};
|
||||
|
||||
focus_on_apply = mkOption {
|
||||
type = enum ["ours" "theirs"];
|
||||
default = "ours";
|
||||
description = "Which diff to focus after applying.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
diff = {
|
||||
autojump =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Automatically jumps to the next change.";
|
||||
};
|
||||
|
||||
override_timeoutlen = mkOption {
|
||||
type = int;
|
||||
default = 500;
|
||||
example = -1;
|
||||
description = ''
|
||||
Override the 'timeoutlen' setting while hovering over a diff (see {command}`:help timeoutlen`).
|
||||
Helps to avoid entering operator-pending mode with diff mappings starting with `c`.
|
||||
Disable by setting to -1.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
suggestion = {
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
default = 600;
|
||||
description = "Suggestion debounce in milliseconds.";
|
||||
};
|
||||
|
||||
throttle = mkOption {
|
||||
type = int;
|
||||
default = 600;
|
||||
description = "Suggestion throttle in milliseconds.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
41
modules/plugins/assistant/avante/config.nix
Normal file
41
modules/plugins/assistant/avante/config.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optionals;
|
||||
|
||||
cfg = config.vim.assistant.avante-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins =
|
||||
[
|
||||
"nvim-treesitter"
|
||||
"plenary-nvim"
|
||||
"dressing-nvim"
|
||||
"nui-nvim"
|
||||
]
|
||||
++ (optionals config.vim.mini.pick.enable ["mini-pick"])
|
||||
++ (optionals config.vim.telescope.enable ["telescope"])
|
||||
++ (optionals config.vim.autocomplete.nvim-cmp.enable ["nvim-cmp"])
|
||||
++ (optionals config.vim.fzf-lua.enable ["fzf-lua"])
|
||||
++ (optionals config.vim.visuals.nvim-web-devicons.enable ["nvim-web-devicons"])
|
||||
++ (optionals config.vim.utility.images.img-clip.enable ["img-clip"]);
|
||||
|
||||
lazy.plugins = {
|
||||
avante-nvim = {
|
||||
package = "avante-nvim";
|
||||
setupModule = "avante";
|
||||
inherit (cfg) setupOpts;
|
||||
event = ["DeferredUIEnter"];
|
||||
};
|
||||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
|
||||
languages.markdown.extensions.render-markdown-nvim.setupOpts.file_types = lib.mkAfter ["Avante"];
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/assistant/avante/default.nix
Normal file
6
modules/plugins/assistant/avante/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./avante-nvim.nix
|
||||
];
|
||||
}
|
|
@ -21,7 +21,17 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
# Codecompanion depends on the YAML grammar being added. Below is
|
||||
# an easy way of adding an user-configurable grammar package exposed
|
||||
# by the YAML language module *without* enabling the whole YAML language
|
||||
# module. The package is defined even when the module is disabled.
|
||||
grammars = [
|
||||
config.vim.languages.yaml.treesitter.package
|
||||
];
|
||||
};
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
./chatgpt
|
||||
./copilot
|
||||
./codecompanion
|
||||
./avante
|
||||
];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
freeformType = attrsOf (listOf (either str luaInline));
|
||||
options = {
|
||||
preset = mkOption {
|
||||
type = enum ["default" "none" "super-tab" "enter"];
|
||||
type = enum ["default" "none" "super-tab" "enter" "cmdline"];
|
||||
default = "none";
|
||||
description = "keymap presets";
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
biome = {
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
|
@ -44,7 +44,7 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Neorg treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
norgPackage = mkGrammarOption pkgs "tree-sitter-norg";
|
||||
norgPackage = mkGrammarOption pkgs "norg";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,9 +21,14 @@ in {
|
|||
'';
|
||||
};
|
||||
onedark = {
|
||||
setup = {style ? "dark", ...}: ''
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent,
|
||||
...
|
||||
}: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
transparent = ${boolToString transparent},
|
||||
style = "${style}"
|
||||
}
|
||||
require('onedark').load()
|
||||
|
@ -95,7 +100,7 @@ in {
|
|||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
'';
|
||||
styles = ["latte" "frappe" "macchiato" "mocha"];
|
||||
styles = ["auto" "latte" "frappe" "macchiato" "mocha"];
|
||||
};
|
||||
|
||||
oxocarbon = {
|
||||
|
|
|
@ -25,14 +25,14 @@ in {
|
|||
type = listOf package;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
pkgs.tree-sitter-grammars; [
|
||||
tree-sitter-regex
|
||||
tree-sitter-kdl
|
||||
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
regex
|
||||
kdl
|
||||
];
|
||||
'';
|
||||
description = ''
|
||||
List of treesitter grammars to install. For grammars to be installed properly,
|
||||
you must use grammars from `pkgs.tree-sitter-grammars`.
|
||||
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
|
||||
|
||||
For languages already supported by nvf, you may use
|
||||
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||
|
@ -55,7 +55,7 @@ in {
|
|||
internal = true;
|
||||
readOnly = true;
|
||||
type = listOf package;
|
||||
default = with pkgs.tree-sitter-grammars; [tree-sitter-c tree-sitter-lua tree-sitter-vim tree-sitter-query];
|
||||
default = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [c lua vim vimdoc query];
|
||||
description = ''
|
||||
A list of treesitter grammars that will be installed by default
|
||||
if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars`
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.strings) optionalString concatMapStringsSep;
|
||||
inherit (lib.lists) optionals concatLists;
|
||||
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||
|
||||
cfg = config.vim.telescope;
|
||||
|
@ -16,7 +16,7 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["plenary-nvim"];
|
||||
startPlugins = ["plenary-nvim"] ++ concatLists (map (x: x.packages) cfg.extensions);
|
||||
|
||||
lazy.plugins.telescope = {
|
||||
package = "telescope";
|
||||
|
@ -28,11 +28,14 @@ in {
|
|||
vim.g.loaded_telescope = nil
|
||||
'';
|
||||
|
||||
after = ''
|
||||
after = let
|
||||
enabledExtensions = map (x: x.name) cfg.extensions;
|
||||
in ''
|
||||
local telescope = require("telescope")
|
||||
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}
|
||||
${optionalString config.vim.notify.nvim-notify.enable "telescope.load_extension('notify')"}
|
||||
${optionalString config.vim.projects.project-nvim.enable "telescope.load_extension('projects')"}
|
||||
${concatMapStringsSep "\n" (x: "telescope.load_extension('${x}')") enabledExtensions}
|
||||
'';
|
||||
|
||||
cmd = ["Telescope"];
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) int str listOf float bool either enum submodule attrsOf;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) int str listOf float bool either enum submodule attrsOf anything package;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
|
||||
cfg = config.vim.telescope;
|
||||
setupOptions = {
|
||||
pickers.find_files.find_command = mkOption {
|
||||
description = "cmd to use for finding files";
|
||||
|
@ -16,10 +19,6 @@
|
|||
|
||||
defaults = {
|
||||
vimgrep_arguments = mkOption {
|
||||
description = ''
|
||||
Defines the command that will be used for `live_grep` and `grep_string` pickers.
|
||||
Make sure that color is set to `never` because telescope does not yet interpret color codes.
|
||||
'';
|
||||
type = listOf str;
|
||||
default = [
|
||||
"${pkgs.ripgrep}/bin/rg"
|
||||
|
@ -32,114 +31,169 @@
|
|||
"--hidden"
|
||||
"--no-ignore"
|
||||
];
|
||||
|
||||
description = ''
|
||||
Defines the command that will be used for `live_grep` and `grep_string` pickers.
|
||||
Make sure that color is set to `never` because telescope does not yet interpret color codes.
|
||||
'';
|
||||
};
|
||||
|
||||
pickers.find_command = mkOption {
|
||||
type = either (listOf str) luaInline;
|
||||
default = ["${pkgs.fd}/bin/fd"];
|
||||
description = ''
|
||||
Command to use for finding files. If using an executable from {env}`PATH` then you must
|
||||
make sure that the package is available in [](#opt-vim.extraPackages).
|
||||
'';
|
||||
};
|
||||
|
||||
prompt_prefix = mkOption {
|
||||
description = "Shown in front of Telescope's prompt";
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "Shown in front of Telescope's prompt";
|
||||
};
|
||||
|
||||
selection_caret = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "Character(s) to show in front of the current selection";
|
||||
type = str;
|
||||
default = " ";
|
||||
};
|
||||
|
||||
entry_prefix = mkOption {
|
||||
description = "Prefix in front of each result entry. Current selection not included.";
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "Prefix in front of each result entry. Current selection not included.";
|
||||
};
|
||||
|
||||
initial_mode = mkOption {
|
||||
description = "Determines in which mode telescope starts.";
|
||||
type = enum ["insert" "normal"];
|
||||
default = "insert";
|
||||
description = "Determines in which mode telescope starts.";
|
||||
};
|
||||
|
||||
selection_strategy = mkOption {
|
||||
description = "Determines how the cursor acts after each sort iteration.";
|
||||
type = enum ["reset" "follow" "row" "closest" "none"];
|
||||
default = "reset";
|
||||
description = "Determines how the cursor acts after each sort iteration.";
|
||||
};
|
||||
|
||||
sorting_strategy = mkOption {
|
||||
description = ''Determines the direction "better" results are sorted towards.'';
|
||||
type = enum ["descending" "ascending"];
|
||||
default = "ascending";
|
||||
description = ''Determines the direction "better" results are sorted towards.'';
|
||||
};
|
||||
|
||||
layout_strategy = mkOption {
|
||||
description = "Determines the default layout of Telescope pickers. See `:help telescope.layout`.";
|
||||
type = str;
|
||||
default = "horizontal";
|
||||
description = "Determines the default layout of Telescope pickers. See `:help telescope.layout`.";
|
||||
};
|
||||
|
||||
layout_config = mkOption {
|
||||
description = ''
|
||||
Determines the default configuration values for layout strategies.
|
||||
See telescope.layout for details of the configurations options for
|
||||
each strategy.
|
||||
'';
|
||||
default = {};
|
||||
type = submodule {
|
||||
options = {
|
||||
horizontal = {
|
||||
prompt_position = mkOption {
|
||||
description = "";
|
||||
type = str;
|
||||
type = enum ["top" "bottom"];
|
||||
default = "top";
|
||||
description = "Where to place prompt window";
|
||||
};
|
||||
|
||||
preview_width = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.55;
|
||||
description = "Change the width of Telescope's preview window";
|
||||
};
|
||||
};
|
||||
|
||||
vertical = {
|
||||
mirror = mkOption {
|
||||
description = "";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Flip the location of the results/prompt and preview windows";
|
||||
};
|
||||
};
|
||||
|
||||
width = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.8;
|
||||
description = "How wide to make Telescope's entire layout";
|
||||
};
|
||||
|
||||
height = mkOption {
|
||||
description = "";
|
||||
type = float;
|
||||
default = 0.8;
|
||||
description = "How tall to make Telescope's entire layout";
|
||||
};
|
||||
|
||||
preview_cutoff = mkOption {
|
||||
description = "";
|
||||
type = int;
|
||||
default = 120;
|
||||
description = "When lines are less than this value, the preview will be disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
description = ''
|
||||
Determines the default configuration values for layout strategies.
|
||||
See `telescope.layout` for details of the configurations options for
|
||||
each strategy.
|
||||
'';
|
||||
};
|
||||
|
||||
file_ignore_patterns = mkOption {
|
||||
description = "A table of lua regex that define the files that should be ignored.";
|
||||
type = listOf str;
|
||||
default = ["node_modules" "%.git/" "dist/" "build/" "target/" "result/"];
|
||||
description = "File patterns to omit from Telescope results";
|
||||
};
|
||||
color_devicons = mkOption {
|
||||
description = "Boolean if devicons should be enabled or not.";
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
color_devicons = mkEnableOption "colored devicons";
|
||||
|
||||
path_display = mkOption {
|
||||
description = "Determines how file paths are displayed.";
|
||||
type = listOf (enum ["hidden" "tail" "absolute" "smart" "shorten" "truncate"]);
|
||||
default = ["absolute"];
|
||||
description = "Determines how file paths are displayed.";
|
||||
};
|
||||
|
||||
set_env = mkOption {
|
||||
description = "Set an environment for term_previewer";
|
||||
type = attrsOf str;
|
||||
default = {
|
||||
COLORTERM = "truecolor";
|
||||
};
|
||||
default = {COLORTERM = "truecolor";};
|
||||
description = "Set an environment for term_previewer";
|
||||
};
|
||||
|
||||
winblend = mkOption {
|
||||
description = "pseudo-transparency of keymap hints floating window";
|
||||
type = int;
|
||||
default = 0;
|
||||
description = "Pseudo-transparency of keymap hints floating window";
|
||||
};
|
||||
|
||||
extensions = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = builtins.foldl' (acc: x: acc // (x.setup or {})) {} cfg.extensions;
|
||||
description = "Attribute set containing per-extension settings for Telescope";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extensionOpts = {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
description = "Name of the extension, will be used to load it with a `require`";
|
||||
};
|
||||
|
||||
packages = mkOption {
|
||||
type = listOf (either str package);
|
||||
default = [];
|
||||
description = "Package or packages providing the Telescope extension to be loaded.";
|
||||
};
|
||||
|
||||
setup = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = {};
|
||||
example = {fzf = {fuzzy = true;};};
|
||||
description = "Named attribute set to be inserted into Telescope's extensions table.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -174,5 +228,24 @@ in {
|
|||
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
||||
|
||||
extensions = mkOption {
|
||||
type = listOf (submodule extensionOpts);
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
name = "fzf";
|
||||
packages = [pkgs.vimPlugins.telescope-fzf-native-nvim];
|
||||
setup = {fzf = {fuzzy = true;};};
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Individual extension configurations containing **name**, **packages** and **setup**
|
||||
fields to resolve dependencies, handle `load_extension` calls and add the `setup`
|
||||
table into the `extensions` portion of Telescope's setup table.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
}: let
|
||||
inherit (pkgs) vimPlugins;
|
||||
inherit (lib.trivial) flip;
|
||||
inherit (builtins) filter isString;
|
||||
inherit (builtins) filter isString hasAttr getAttr;
|
||||
|
||||
getPin = name: ((pkgs.callPackages ../../../npins/sources.nix {}) // config.vim.pluginOverrides).${name};
|
||||
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
|
||||
|
||||
noBuildPlug = pname: let
|
||||
pin = getPin pname;
|
||||
|
@ -48,13 +48,22 @@
|
|||
doCheck = false;
|
||||
};
|
||||
|
||||
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp;
|
||||
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
|
||||
};
|
||||
|
||||
buildConfigPlugins = plugins:
|
||||
map (plug:
|
||||
if (isString plug)
|
||||
then pluginBuilders.${plug} or (noBuildPlug plug)
|
||||
then
|
||||
if hasAttr plug config.vim.pluginOverrides
|
||||
then
|
||||
(let
|
||||
plugin = config.vim.pluginOverrides.${plug};
|
||||
in
|
||||
if (lib.isType "flake" plugin)
|
||||
then plugin // {name = plug;}
|
||||
else plugin)
|
||||
else pluginBuilders.${plug} or (noBuildPlug plug)
|
||||
else plug) (
|
||||
filter (f: f != null) plugins
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ in {
|
|||
description = ''
|
||||
[official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||
|
||||
Whethere to enable the experimental Lua module loader to speed up the start
|
||||
Whether to enable the experimental Lua module loader to speed up the start
|
||||
up process. If `true`, this will enable the experimental Lua module loader
|
||||
which:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue