helpers/vim-plugin/mkVimPlugin: refactor

This commit is contained in:
Gaetan Lepage 2024-02-09 14:21:22 +01:00 committed by Gaétan Lepage
parent 66c069c48d
commit 3c174e874c
20 changed files with 739 additions and 744 deletions

View file

@ -3,11 +3,7 @@
nixvimOptions, nixvimOptions,
}: }:
with lib; { with lib; {
mkVimPlugin = { mkVimPlugin = config: {
config,
lib,
...
}: {
name, name,
description ? null, description ? null,
package ? null, package ? null,

View file

@ -1,42 +1,43 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; ( with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { helpers.vim-plugin.mkVimPlugin config {
name = "copilot-vim"; name = "copilot-vim";
description = "copilot.vim"; description = "copilot.vim";
package = pkgs.vimPlugins.copilot-vim; package = pkgs.vimPlugins.copilot-vim;
globalPrefix = "copilot_"; globalPrefix = "copilot_";
options = { options = {
nodeCommand = mkDefaultOpt { nodeCommand = mkDefaultOpt {
global = "node_command"; global = "node_command";
type = types.str; type = types.str;
default = "${pkgs.nodejs-18_x}/bin/node"; default = "${pkgs.nodejs-18_x}/bin/node";
description = "Tell Copilot what `node` binary to use."; description = "Tell Copilot what `node` binary to use.";
}; };
filetypes = mkDefaultOpt { filetypes = mkDefaultOpt {
type = with types; attrsOf bool; type = with types; attrsOf bool;
description = '' description = ''
A dictionary mapping file types to their enabled status A dictionary mapping file types to their enabled status
Default: `{}` Default: `{}`
''; '';
example = { example = {
"*" = false; "*" = false;
python = true; python = true;
};
};
proxy = mkDefaultOpt {
type = types.str;
description = "Tell Copilot what proxy server to use.";
example = "localhost:3128";
}; };
}; };
}
) proxy = mkDefaultOpt {
type = types.str;
description = "Tell Copilot what proxy server to use.";
example = "localhost:3128";
};
};
}

View file

@ -14,7 +14,7 @@ in
useDefaultPackage ? true, useDefaultPackage ? true,
... ...
}: }:
mkVimPlugin {inherit lib config pkgs;} { mkVimPlugin config {
inherit name; inherit name;
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name}); extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
}; };

View file

@ -1,18 +1,15 @@
{ {
lib, config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; helpers.vim-plugin.mkVimPlugin config {
in name = "fugitive";
with helpers.vim-plugin; description = "vim-fugitive";
with lib; package = pkgs.vimPlugins.vim-fugitive;
mkVimPlugin attrs { extraPackages = [pkgs.git];
name = "fugitive";
description = "vim-fugitive";
package = pkgs.vimPlugins.vim-fugitive;
extraPackages = [pkgs.git];
# In typical tpope fashion, this plugin has no config options # In typical tpope fashion, this plugin has no config options
options = {}; options = {};
} }

View file

@ -1,11 +1,13 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "ledger"; name = "ledger";
description = "ledger language features"; description = "ledger language features";
package = pkgs.vimPlugins.vim-ledger; package = pkgs.vimPlugins.vim-ledger;

View file

@ -1,12 +1,13 @@
{ {
lib, lib,
pkgs, config,
helpers, helpers,
pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "markdown-preview"; name = "markdown-preview";
description = "markdown-preview.nvim"; description = "markdown-preview.nvim";
package = pkgs.vimPlugins.markdown-preview-nvim; package = pkgs.vimPlugins.markdown-preview-nvim;

View file

@ -1,17 +1,14 @@
{ {
lib, config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; helpers.vim-plugin.mkVimPlugin config {
in name = "nix";
with helpers.vim-plugin; description = "vim-nix";
with lib; package = pkgs.vimPlugins.vim-nix;
mkVimPlugin attrs {
name = "nix";
description = "vim-nix";
package = pkgs.vimPlugins.vim-nix;
# Possibly add option to disable Treesitter highlighting if this is installed # Possibly add option to disable Treesitter highlighting if this is installed
options = {}; options = {};
} }

View file

@ -1,13 +1,12 @@
{ {
lib, helpers,
config,
pkgs, pkgs,
... ...
} @ args: }:
with lib; helpers.vim-plugin.mkVimPlugin config {
with (import ../helpers.nix {inherit lib;}).vim-plugin; name = "tagbar";
mkVimPlugin args { package = pkgs.vimPlugins.tagbar;
name = "tagbar"; globalPrefix = "tagbar_";
package = pkgs.vimPlugins.tagbar; extraPackages = [pkgs.ctags];
globalPrefix = "tagbar_"; }
extraPackages = [pkgs.ctags];
}

View file

@ -1,125 +1,125 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: let }:
helpers = import ../helpers.nix {inherit lib;}; with lib;
in with helpers.vim-plugin;
with lib; mkVimPlugin config {
with helpers.vim-plugin; name = "vim-slime";
mkVimPlugin args { package = pkgs.vimPlugins.vim-slime;
name = "vim-slime"; globalPrefix = "slime_";
package = pkgs.vimPlugins.vim-slime;
globalPrefix = "slime_";
options = { options = {
target = mkDefaultOpt { target = mkDefaultOpt {
type = types.enum [ type = types.enum [
"dtach" "dtach"
"kitty" "kitty"
"neovim" "neovim"
"screen" "screen"
"tmux" "tmux"
"vimterminal" "vimterminal"
"wezterm" "wezterm"
"whimrepl" "whimrepl"
"x11" "x11"
"zellij" "zellij"
]; ];
description = '' description = ''
Which backend vim-slime should use. Which backend vim-slime should use.
Default: "screen" Default: "screen"
''; '';
example = "dtach"; example = "dtach";
};
vimterminalCmd = mkDefaultOpt {
global = "vimterminal_cmd";
type = types.str;
description = "The vim terminal command to execute.";
};
noMappings = mkDefaultOpt {
global = "no_mappings";
type = types.bool;
description = ''
Whether to disable the default mappings.
Default: `false`
'';
};
pasteFile = mkDefaultOpt {
global = "paste_file";
type = types.str;
description = ''
Required to transfer data from vim to GNU screen or tmux.
Setting this explicitly can work around some occasional portability issues.
whimrepl does not require or support this setting.
Default: "$HOME/.slime_paste"
'';
};
preserveCurpos = mkDefaultOpt {
global = "preserve_curpos";
type = types.bool;
description = ''
Whether to preserve cursor position when sending a line or paragraph.
Default: `true`
'';
};
defaultConfig = mkDefaultOpt {
global = "default_config";
type = with helpers.nixvimTypes; attrsOf (either str rawLua);
description = ''
Pre-filled prompt answer.
Default: `null`
Examples:
- `tmux`:
```nix
{
socket_name = "default";
target_pane = "{last}";
}
```
- `zellij`:
```nix
{
session_id = "current";
relative_pane = "right";
}
```
'';
};
dontAskDefault = mkDefaultOpt {
global = "dont_ask_default";
type = types.bool;
description = ''
Whether to bypass the prompt and use the specified default configuration options.
Default: `false`
'';
};
bracketedPaste = mkDefaultOpt {
global = "bracketed_paste";
type = with types; nullOr bool;
description = ''
Sometimes REPL are too smart for their own good, e.g. autocompleting a bracket that should
not be autocompleted when pasting code from a file.
In this case it can be useful to rely on bracketed-paste
(https://cirw.in/blog/bracketed-paste).
Luckily, tmux knows how to handle that. See tmux's manual.
Default: `false`
'';
};
}; };
}
vimterminalCmd = mkDefaultOpt {
global = "vimterminal_cmd";
type = types.str;
description = "The vim terminal command to execute.";
};
noMappings = mkDefaultOpt {
global = "no_mappings";
type = types.bool;
description = ''
Whether to disable the default mappings.
Default: `false`
'';
};
pasteFile = mkDefaultOpt {
global = "paste_file";
type = types.str;
description = ''
Required to transfer data from vim to GNU screen or tmux.
Setting this explicitly can work around some occasional portability issues.
whimrepl does not require or support this setting.
Default: "$HOME/.slime_paste"
'';
};
preserveCurpos = mkDefaultOpt {
global = "preserve_curpos";
type = types.bool;
description = ''
Whether to preserve cursor position when sending a line or paragraph.
Default: `true`
'';
};
defaultConfig = mkDefaultOpt {
global = "default_config";
type = with helpers.nixvimTypes; attrsOf (either str rawLua);
description = ''
Pre-filled prompt answer.
Default: `null`
Examples:
- `tmux`:
```nix
{
socket_name = "default";
target_pane = "{last}";
}
```
- `zellij`:
```nix
{
session_id = "current";
relative_pane = "right";
}
```
'';
};
dontAskDefault = mkDefaultOpt {
global = "dont_ask_default";
type = types.bool;
description = ''
Whether to bypass the prompt and use the specified default configuration options.
Default: `false`
'';
};
bracketedPaste = mkDefaultOpt {
global = "bracketed_paste";
type = with types; nullOr bool;
description = ''
Sometimes REPL are too smart for their own good, e.g. autocompleting a bracket that should
not be autocompleted when pasting code from a file.
In this case it can be useful to rely on bracketed-paste
(https://cirw.in/blog/bracketed-paste).
Luckily, tmux knows how to handle that. See tmux's manual.
Default: `false`
'';
};
};
}

View file

@ -1,24 +1,24 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; with lib;
in with helpers.vim-plugin;
with helpers.vim-plugin; mkVimPlugin config {
with lib; name = "zig";
mkVimPlugin attrs { description = "zig.vim";
name = "zig"; package = pkgs.vimPlugins.zig-vim;
description = "zig.vim"; globalPrefix = "zig_";
package = pkgs.vimPlugins.zig-vim;
globalPrefix = "zig_";
# Possibly add option to disable Treesitter highlighting if this is installed # Possibly add option to disable Treesitter highlighting if this is installed
options = { options = {
formatOnSave = mkDefaultOpt { formatOnSave = mkDefaultOpt {
type = types.bool; type = types.bool;
global = "fmt_autosave"; global = "fmt_autosave";
description = "Run zig fmt on save"; description = "Run zig fmt on save";
};
}; };
} };
}

View file

@ -1,11 +1,13 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "airline"; name = "airline";
description = "vim-airline"; description = "vim-airline";
package = pkgs.vimPlugins.vim-airline; package = pkgs.vimPlugins.vim-airline;

View file

@ -1,34 +1,34 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: }:
with lib; let with lib;
helpers = import ../helpers.nix {inherit lib;}; with helpers.vim-plugin;
in mkVimPlugin config {
with helpers.vim-plugin; name = "emmet";
mkVimPlugin attrs { package = pkgs.vimPlugins.emmet-vim;
name = "emmet"; globalPrefix = "user_emmet_";
package = pkgs.vimPlugins.emmet-vim;
globalPrefix = "user_emmet_";
options = { options = {
mode = mkDefaultOpt { mode = mkDefaultOpt {
type = types.enum ["i" "n" "v" "a"]; type = types.enum ["i" "n" "v" "a"];
global = "mode"; global = "mode";
description = "Mode where emmet will enable"; description = "Mode where emmet will enable";
};
leader = mkDefaultOpt {
type = types.str;
global = "leader_key";
description = "Set leader key";
};
settings = mkDefaultOpt {
type = with types; attrsOf anything;
global = "settings";
description = "Emmet settings";
};
}; };
}
leader = mkDefaultOpt {
type = types.str;
global = "leader_key";
description = "Set leader key";
};
settings = mkDefaultOpt {
type = with types; attrsOf anything;
global = "settings";
description = "Emmet settings";
};
};
}

View file

@ -1,17 +1,14 @@
{ {
lib, config,
pkgs, pkgs,
helpers,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; helpers.vim-plugin.mkVimPlugin config {
in name = "endwise";
with helpers.vim-plugin; description = "vim-endwise";
with lib; package = pkgs.vimPlugins.vim-endwise;
mkVimPlugin attrs {
name = "endwise";
description = "vim-endwise";
package = pkgs.vimPlugins.vim-endwise;
# Yes it's really not configurable # Yes it's really not configurable
options = {}; options = {};
} }

View file

@ -1,35 +1,35 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; with helpers.vim-plugin;
in with lib;
with helpers.vim-plugin; mkVimPlugin config {
with lib; name = "goyo";
mkVimPlugin attrs { description = "goyo.vim";
name = "goyo"; package = pkgs.vimPlugins.goyo-vim;
description = "goyo.vim"; globalPrefix = "goyo_";
package = pkgs.vimPlugins.goyo-vim;
globalPrefix = "goyo_";
options = { options = {
width = mkDefaultOpt { width = mkDefaultOpt {
description = "Width"; description = "Width";
global = "width"; global = "width";
type = types.int; type = types.int;
};
height = mkDefaultOpt {
description = "Height";
global = "height";
type = types.int;
};
showLineNumbers = mkDefaultOpt {
description = "Show line numbers when in Goyo mode";
global = "linenr";
type = types.bool;
};
}; };
}
height = mkDefaultOpt {
description = "Height";
global = "height";
type = types.int;
};
showLineNumbers = mkDefaultOpt {
description = "Show line numbers when in Goyo mode";
global = "linenr";
type = types.bool;
};
};
}

View file

@ -1,11 +1,13 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "instant"; name = "instant";
description = "instant.nvim"; description = "instant.nvim";
package = pkgs.vimPlugins.instant-nvim; package = pkgs.vimPlugins.instant-nvim;

View file

@ -1,11 +1,13 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "magma-nvim"; name = "magma-nvim";
description = "magma-nvim"; description = "magma-nvim";
package = pkgs.vimPlugins.magma-nvim-goose; package = pkgs.vimPlugins.magma-nvim-goose;

View file

@ -1,211 +1,211 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: let }:
helpers = import ../helpers.nix {inherit lib;}; with lib;
in with helpers.vim-plugin;
with lib; mkVimPlugin config {
with helpers.vim-plugin; name = "molten";
mkVimPlugin args { description = "molten-nvim";
name = "molten"; package = pkgs.vimPlugins.molten-nvim;
description = "molten-nvim"; globalPrefix = "molten_";
package = pkgs.vimPlugins.molten-nvim;
globalPrefix = "molten_";
options = { options = {
autoOpenOutput = mkDefaultOpt { autoOpenOutput = mkDefaultOpt {
global = "auto_open_output"; global = "auto_open_output";
description = '' description = ''
Automatically open the output window when your cursor moves over a cell. Automatically open the output window when your cursor moves over a cell.
Default: `true` Default: `true`
''; '';
type = types.bool; type = types.bool;
example = false; example = false;
};
copyOutput = mkDefaultOpt {
global = "copy_output";
description = ''
Copy evaluation output to clipboard automatically (requires pyperclip).
Default: `false`
'';
type = types.bool;
example = true;
};
enterOutputBehavior = mkDefaultOpt {
global = "enter_output_behavior";
description = ''
The behavior of MoltenEnterOutput.
Default: `"open_then_enter"`
'';
type = types.enum ["open_then_enter" "open_and_enter" "no_open"];
};
imageProvider = mkDefaultOpt {
global = "image_provider";
description = ''
How images are displayed.
Default: `"none"`
'';
type = types.enum ["none" "image.nvim"];
};
outputCropBorder = mkDefaultOpt {
global = "output_crop_border";
description = ''
'crops' the bottom border of the output window when it would otherwise just sit at the
bottom of the screen.
Default: `true`
'';
type = types.bool;
};
outputShowMore = mkDefaultOpt {
global = "output_show_more";
description = ''
When the window can't display the entire contents of the output buffer, shows the number
of extra lines in the window footer (requires nvim 10.0+ and a window border).
Default: `false`
'';
type = types.bool;
};
outputVirtLines = mkDefaultOpt {
global = "output_virt_lines";
description = ''
Pad the main buffer with virtual lines so the output doesn't cover anything while it's
open.
Default: `false`
'';
type = types.bool;
};
outputWinBorder = mkDefaultOpt {
global = "output_win_border";
description = ''
Some border features will not work if you don't specify your border as a table.
See border option of `:h nvim_open_win()`.
Default: `["" "" "" ""]`
'';
type = helpers.nixvimTypes.border;
};
outputWinCoverGutter = mkDefaultOpt {
global = "output_win_cover_gutter";
description = ''
Should the output window cover the gutter (numbers and sign col), or not.
If you change this, you probably also want to change `outputWinStyle`.
Default: `true`
'';
type = types.bool;
};
outputWinHideOnLeave = mkDefaultOpt {
global = "output_win_hide_on_leave";
description = ''
After leaving the output window (via `:q` or switching windows), do not attempt to redraw
the output window.
Default: `true`
'';
type = types.bool;
};
outputWinMaxHeight = mkDefaultOpt {
global = "output_win_max_height";
description = ''
Max height of the output window.
Default: `999999`
'';
type = types.ints.unsigned;
};
outputWinMaxWidth = mkDefaultOpt {
global = "output_win_max_width";
description = ''
Max width of the output window.
Default: `999999`
'';
type = types.ints.unsigned;
};
outputWinStyle = mkDefaultOpt {
global = "output_win_style";
description = ''
Value passed to the `style` option in `:h nvim_open_win()`
Default: `false`
'';
type = types.enum [false "minimal"];
};
savePath = mkDefaultOpt {
global = "save_path";
description = ''
Where to save/load data with `:MoltenSave` and `:MoltenLoad`.
Default: `{__raw = "vim.fn.stdpath('data')..'/molten'";}`
'';
type = with helpers.nixvimTypes; either str rawLua;
};
useBorderHighlights = mkDefaultOpt {
global = "use_border_highlights";
description = ''
When true, uses different highlights for output border depending on the state of the cell
(running, done, error).
See [highlights](https://github.com/benlubas/molten-nvim#highlights).
Default: `false`
'';
type = types.bool;
};
virtLinesOffBy1 = mkDefaultOpt {
global = "virt_lines_off_by_1";
description = ''
_Only has effect when `outputVirtLines` is true._
Allows the output window to cover exactly one line of the regular buffer.
(useful for running code in a markdown file where that covered line will just be ```)
Default: `false`
'';
type = types.bool;
};
wrapOutput = mkDefaultOpt {
global = "wrap_output";
description = ''
Wrap text in output windows.
Default: `false`
'';
type = types.bool;
};
# Debug
showMimetypeDebug = mkDefaultOpt {
global = "show_mimetype_debug";
description = ''
Before any non-iostream output chunk, the mime-type for that output chunk is shown.
Meant for debugging/plugin devlopment.
Default: `false`
'';
type = types.bool;
};
}; };
}
copyOutput = mkDefaultOpt {
global = "copy_output";
description = ''
Copy evaluation output to clipboard automatically (requires pyperclip).
Default: `false`
'';
type = types.bool;
example = true;
};
enterOutputBehavior = mkDefaultOpt {
global = "enter_output_behavior";
description = ''
The behavior of MoltenEnterOutput.
Default: `"open_then_enter"`
'';
type = types.enum ["open_then_enter" "open_and_enter" "no_open"];
};
imageProvider = mkDefaultOpt {
global = "image_provider";
description = ''
How images are displayed.
Default: `"none"`
'';
type = types.enum ["none" "image.nvim"];
};
outputCropBorder = mkDefaultOpt {
global = "output_crop_border";
description = ''
'crops' the bottom border of the output window when it would otherwise just sit at the
bottom of the screen.
Default: `true`
'';
type = types.bool;
};
outputShowMore = mkDefaultOpt {
global = "output_show_more";
description = ''
When the window can't display the entire contents of the output buffer, shows the number
of extra lines in the window footer (requires nvim 10.0+ and a window border).
Default: `false`
'';
type = types.bool;
};
outputVirtLines = mkDefaultOpt {
global = "output_virt_lines";
description = ''
Pad the main buffer with virtual lines so the output doesn't cover anything while it's
open.
Default: `false`
'';
type = types.bool;
};
outputWinBorder = mkDefaultOpt {
global = "output_win_border";
description = ''
Some border features will not work if you don't specify your border as a table.
See border option of `:h nvim_open_win()`.
Default: `["" "" "" ""]`
'';
type = helpers.nixvimTypes.border;
};
outputWinCoverGutter = mkDefaultOpt {
global = "output_win_cover_gutter";
description = ''
Should the output window cover the gutter (numbers and sign col), or not.
If you change this, you probably also want to change `outputWinStyle`.
Default: `true`
'';
type = types.bool;
};
outputWinHideOnLeave = mkDefaultOpt {
global = "output_win_hide_on_leave";
description = ''
After leaving the output window (via `:q` or switching windows), do not attempt to redraw
the output window.
Default: `true`
'';
type = types.bool;
};
outputWinMaxHeight = mkDefaultOpt {
global = "output_win_max_height";
description = ''
Max height of the output window.
Default: `999999`
'';
type = types.ints.unsigned;
};
outputWinMaxWidth = mkDefaultOpt {
global = "output_win_max_width";
description = ''
Max width of the output window.
Default: `999999`
'';
type = types.ints.unsigned;
};
outputWinStyle = mkDefaultOpt {
global = "output_win_style";
description = ''
Value passed to the `style` option in `:h nvim_open_win()`
Default: `false`
'';
type = types.enum [false "minimal"];
};
savePath = mkDefaultOpt {
global = "save_path";
description = ''
Where to save/load data with `:MoltenSave` and `:MoltenLoad`.
Default: `{__raw = "vim.fn.stdpath('data')..'/molten'";}`
'';
type = with helpers.nixvimTypes; either str rawLua;
};
useBorderHighlights = mkDefaultOpt {
global = "use_border_highlights";
description = ''
When true, uses different highlights for output border depending on the state of the cell
(running, done, error).
See [highlights](https://github.com/benlubas/molten-nvim#highlights).
Default: `false`
'';
type = types.bool;
};
virtLinesOffBy1 = mkDefaultOpt {
global = "virt_lines_off_by_1";
description = ''
_Only has effect when `outputVirtLines` is true._
Allows the output window to cover exactly one line of the regular buffer.
(useful for running code in a markdown file where that covered line will just be ```)
Default: `false`
'';
type = types.bool;
};
wrapOutput = mkDefaultOpt {
global = "wrap_output";
description = ''
Wrap text in output windows.
Default: `false`
'';
type = types.bool;
};
# Debug
showMimetypeDebug = mkDefaultOpt {
global = "show_mimetype_debug";
description = ''
Before any non-iostream output chunk, the mime-type for that output chunk is shown.
Meant for debugging/plugin devlopment.
Default: `false`
'';
type = types.bool;
};
};
}

View file

@ -1,233 +1,233 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: let }:
helpers = import ../helpers.nix {inherit lib;}; with lib;
in with helpers.vim-plugin;
with lib; mkVimPlugin config {
with helpers.vim-plugin; name = "startify";
mkVimPlugin args { package = pkgs.vimPlugins.vim-startify;
name = "startify"; globalPrefix = "startify_";
package = pkgs.vimPlugins.vim-startify;
globalPrefix = "startify_";
options = { options = {
sessionDir = mkDefaultOpt { sessionDir = mkDefaultOpt {
description = "Directory to save/load session"; description = "Directory to save/load session";
global = "session_dir"; global = "session_dir";
type = types.str; type = types.str;
};
lists = mkDefaultOpt {
description = "Startify display lists. If it's a string, it'll be interpreted as literal lua code";
global = "lists";
type = types.listOf (types.oneOf [
(types.submodule {
options = {
type = mkOption {
type = types.str;
description = "The type of the list";
};
# TODO the header should be a literal lua string!
header = mkOption {
type = types.nullOr (types.listOf types.str);
description = "Optional header. It's a list of strings";
default = null;
};
indices = mkOption {
type = types.nullOr (types.listOf types.str);
description = "Optional indices for the current list";
default = null;
};
};
})
types.str
]);
value = val: let
list = map (v:
if builtins.isAttrs v
then toLuaObject v
else v)
val;
in
"{" + (concatStringsSep "," list) + "}";
};
bookmarks = mkDefaultOpt {
description = "A list of files or directories to bookmark.";
global = "bookmarks";
type = with types; listOf (oneOf [str (attrsOf str)]);
};
commands = mkDefaultOpt {
description = "A list of commands to execute on selection";
global = "commands";
type = with types; listOf (oneOf [str (listOf str) attrs]);
};
filesNumber = mkDefaultOpt {
description = "The number of files to list";
global = "files_number";
type = types.int;
};
updateOldFiles = mkDefaultOpt {
description = "Update v:oldfiles on-the-fly, so that :Startify is always up-to-date";
global = "update_oldfiles";
type = types.bool;
};
sessionAutoload = mkDefaultOpt {
description = "Load Session.vim";
global = "session_autoload";
type = types.bool;
};
sessionBeforeSave = mkDefaultOpt {
description = "Commands to be executed before saving a session";
global = "session_before_save";
type = types.listOf types.str;
};
sessionPersistence = mkDefaultOpt {
description = "Automatically update sessions";
global = "session_persistence";
type = types.bool;
};
sessionDeleteBuffers = mkDefaultOpt {
description = "Delete all buffers when loading or closing a session";
global = "session_delete_buffers";
type = types.bool;
};
changeToDir = mkDefaultOpt {
description = "When opening a file or bookmark, change to its directory";
global = "change_to_dir";
type = types.bool;
};
changeToVcsRoot = mkDefaultOpt {
description = "When opening a file or bookmark, change to the root directory of the VCS";
global = "change_to_vcs_root";
type = types.bool;
};
changeCmd = mkDefaultOpt {
description = "The default command for switching directories";
global = "change_cmd";
type = types.enum ["cd" "lcd" "tcd"];
};
skipList = mkDefaultOpt {
description = "A list of regexes that is used to filter recently used files";
global = "skiplist";
type = types.listOf types.str;
};
useUnicode = mkDefaultOpt {
description = "Use unicode box drawing characters for the fortune header";
global = "fortune_use_unicode";
type = types.bool;
};
paddingLeft = mkDefaultOpt {
description = "Number of spaces used for left padding";
global = "padding_left";
type = types.int;
};
skipListServer = mkDefaultOpt {
description = "Do not create the startify buffer if this is a Vim server instance with a name contained in this list";
global = "skiplist_server";
type = types.listOf types.str;
};
enableSpecial = mkDefaultOpt {
description = "Show <empty buffer> and <quit>";
global = "enable_special";
type = types.bool;
};
enableUnsafe = mkDefaultOpt {
description = "Improves start time but reduces accuracy of the file list";
global = "enable_unsafe";
type = types.bool;
};
sessionRemoveLines = mkDefaultOpt {
description = "Lines matching any of the patterns in this list will be removed from the session file";
global = "session_remove_lines";
type = types.listOf types.str;
};
sessionSaveVars = mkDefaultOpt {
description = "List of variables for Startify to save into the session file";
global = "session_savevars";
type = types.listOf types.str;
};
sessionSaveCmds = mkDefaultOpt {
description = "List of cmdline commands to run when loading the session";
global = "session_savecmds";
type = types.listOf types.str;
};
sessionNumber = mkDefaultOpt {
description = "Maximum number of sessions to display";
global = "session_number";
type = types.listOf types.str;
};
sessionSort = mkDefaultOpt {
description = "Sort sessions by modification time rather than alphabetically";
global = "session_sort";
type = types.bool;
};
customIndices = mkDefaultOpt {
description = "Use this list as indices instead of increasing numbers";
global = "custom_indices";
type = types.listOf types.str;
};
customHeader = mkDefaultOpt {
description = "Define your own header";
global = "custom_header";
type = types.oneOf [types.str (types.listOf types.str)];
};
customQuotes = mkDefaultOpt {
description = "Own quotes for the cowsay header";
global = "custom_header_quotes";
# TODO this should also support funcrefs!
type = types.listOf (types.listOf types.str);
};
customFooter = mkDefaultOpt {
description = "Custom footer";
global = "custom_footer";
type = types.str;
};
disableAtVimEnter = mkDefaultOpt {
description = "Don't run Startify at Vim startup";
global = "disable_at_vimenter";
type = types.bool;
};
relativePath = mkDefaultOpt {
description = "If the file is in or below the current working directory, use a relative path";
global = "relative_path";
type = types.bool;
};
useEnv = mkDefaultOpt {
description = "Show environment variables in path, if their name is shorter than their value";
global = "use_env";
type = types.bool;
};
}; };
}
lists = mkDefaultOpt {
description = "Startify display lists. If it's a string, it'll be interpreted as literal lua code";
global = "lists";
type = types.listOf (types.oneOf [
(types.submodule {
options = {
type = mkOption {
type = types.str;
description = "The type of the list";
};
# TODO the header should be a literal lua string!
header = mkOption {
type = types.nullOr (types.listOf types.str);
description = "Optional header. It's a list of strings";
default = null;
};
indices = mkOption {
type = types.nullOr (types.listOf types.str);
description = "Optional indices for the current list";
default = null;
};
};
})
types.str
]);
value = val: let
list = map (v:
if builtins.isAttrs v
then toLuaObject v
else v)
val;
in
"{" + (concatStringsSep "," list) + "}";
};
bookmarks = mkDefaultOpt {
description = "A list of files or directories to bookmark.";
global = "bookmarks";
type = with types; listOf (oneOf [str (attrsOf str)]);
};
commands = mkDefaultOpt {
description = "A list of commands to execute on selection";
global = "commands";
type = with types; listOf (oneOf [str (listOf str) attrs]);
};
filesNumber = mkDefaultOpt {
description = "The number of files to list";
global = "files_number";
type = types.int;
};
updateOldFiles = mkDefaultOpt {
description = "Update v:oldfiles on-the-fly, so that :Startify is always up-to-date";
global = "update_oldfiles";
type = types.bool;
};
sessionAutoload = mkDefaultOpt {
description = "Load Session.vim";
global = "session_autoload";
type = types.bool;
};
sessionBeforeSave = mkDefaultOpt {
description = "Commands to be executed before saving a session";
global = "session_before_save";
type = types.listOf types.str;
};
sessionPersistence = mkDefaultOpt {
description = "Automatically update sessions";
global = "session_persistence";
type = types.bool;
};
sessionDeleteBuffers = mkDefaultOpt {
description = "Delete all buffers when loading or closing a session";
global = "session_delete_buffers";
type = types.bool;
};
changeToDir = mkDefaultOpt {
description = "When opening a file or bookmark, change to its directory";
global = "change_to_dir";
type = types.bool;
};
changeToVcsRoot = mkDefaultOpt {
description = "When opening a file or bookmark, change to the root directory of the VCS";
global = "change_to_vcs_root";
type = types.bool;
};
changeCmd = mkDefaultOpt {
description = "The default command for switching directories";
global = "change_cmd";
type = types.enum ["cd" "lcd" "tcd"];
};
skipList = mkDefaultOpt {
description = "A list of regexes that is used to filter recently used files";
global = "skiplist";
type = types.listOf types.str;
};
useUnicode = mkDefaultOpt {
description = "Use unicode box drawing characters for the fortune header";
global = "fortune_use_unicode";
type = types.bool;
};
paddingLeft = mkDefaultOpt {
description = "Number of spaces used for left padding";
global = "padding_left";
type = types.int;
};
skipListServer = mkDefaultOpt {
description = "Do not create the startify buffer if this is a Vim server instance with a name contained in this list";
global = "skiplist_server";
type = types.listOf types.str;
};
enableSpecial = mkDefaultOpt {
description = "Show <empty buffer> and <quit>";
global = "enable_special";
type = types.bool;
};
enableUnsafe = mkDefaultOpt {
description = "Improves start time but reduces accuracy of the file list";
global = "enable_unsafe";
type = types.bool;
};
sessionRemoveLines = mkDefaultOpt {
description = "Lines matching any of the patterns in this list will be removed from the session file";
global = "session_remove_lines";
type = types.listOf types.str;
};
sessionSaveVars = mkDefaultOpt {
description = "List of variables for Startify to save into the session file";
global = "session_savevars";
type = types.listOf types.str;
};
sessionSaveCmds = mkDefaultOpt {
description = "List of cmdline commands to run when loading the session";
global = "session_savecmds";
type = types.listOf types.str;
};
sessionNumber = mkDefaultOpt {
description = "Maximum number of sessions to display";
global = "session_number";
type = types.listOf types.str;
};
sessionSort = mkDefaultOpt {
description = "Sort sessions by modification time rather than alphabetically";
global = "session_sort";
type = types.bool;
};
customIndices = mkDefaultOpt {
description = "Use this list as indices instead of increasing numbers";
global = "custom_indices";
type = types.listOf types.str;
};
customHeader = mkDefaultOpt {
description = "Define your own header";
global = "custom_header";
type = types.oneOf [types.str (types.listOf types.str)];
};
customQuotes = mkDefaultOpt {
description = "Own quotes for the cowsay header";
global = "custom_header_quotes";
# TODO this should also support funcrefs!
type = types.listOf (types.listOf types.str);
};
customFooter = mkDefaultOpt {
description = "Custom footer";
global = "custom_footer";
type = types.str;
};
disableAtVimEnter = mkDefaultOpt {
description = "Don't run Startify at Vim startup";
global = "disable_at_vimenter";
type = types.bool;
};
relativePath = mkDefaultOpt {
description = "If the file is in or below the current working directory, use a relative path";
global = "relative_path";
type = types.bool;
};
useEnv = mkDefaultOpt {
description = "Show environment variables in path, if their name is shorter than their value";
global = "use_env";
type = types.bool;
};
};
}

View file

@ -1,16 +1,13 @@
{ {
lib, config,
helpers,
pkgs, pkgs,
... ...
} @ attrs: let }:
helpers = import ../helpers.nix {inherit lib;}; helpers.vim-plugin.mkVimPlugin config {
in name = "surround";
with helpers.vim-plugin; description = "surround.vim";
with lib; package = pkgs.vimPlugins.surround;
mkVimPlugin attrs {
name = "surround";
description = "surround.vim";
package = pkgs.vimPlugins.surround;
options = {}; options = {};
} }

View file

@ -1,11 +1,13 @@
{ {
lib, lib,
config,
helpers,
pkgs, pkgs,
... ...
} @ args: }:
with lib; with lib;
with (import ../helpers.nix {inherit lib;}).vim-plugin; with helpers.vim-plugin;
mkVimPlugin args { mkVimPlugin config {
name = "undotree"; name = "undotree";
package = pkgs.vimPlugins.undotree; package = pkgs.vimPlugins.undotree;
globalPrefix = "undotree_"; globalPrefix = "undotree_";