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

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

View file

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

View file

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

View file

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

View file

@ -1,125 +1,125 @@
{
lib,
config,
helpers,
pkgs,
...
} @ args: let
helpers = import ../helpers.nix {inherit lib;};
in
with lib;
with helpers.vim-plugin;
mkVimPlugin args {
name = "vim-slime";
package = pkgs.vimPlugins.vim-slime;
globalPrefix = "slime_";
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "vim-slime";
package = pkgs.vimPlugins.vim-slime;
globalPrefix = "slime_";
options = {
target = mkDefaultOpt {
type = types.enum [
"dtach"
"kitty"
"neovim"
"screen"
"tmux"
"vimterminal"
"wezterm"
"whimrepl"
"x11"
"zellij"
];
description = ''
Which backend vim-slime should use.
options = {
target = mkDefaultOpt {
type = types.enum [
"dtach"
"kitty"
"neovim"
"screen"
"tmux"
"vimterminal"
"wezterm"
"whimrepl"
"x11"
"zellij"
];
description = ''
Which backend vim-slime should use.
Default: "screen"
'';
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`
'';
};
Default: "screen"
'';
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`
'';
};
};
}

View file

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