mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
helpers: move mkPlugin and mkDefaultOpt to helpers.vim-plugin
This commit is contained in:
parent
ddce82d0d1
commit
8f90372ee5
22 changed files with 445 additions and 435 deletions
|
@ -71,7 +71,7 @@ You will then need to add Nix options for all (or most) of the upstream plugin o
|
||||||
These options should be in `camelCase` (whereas most plugins define their options in `snake_case`), and their names should match exactly (except the case) to the upstream names.
|
These options should be in `camelCase` (whereas most plugins define their options in `snake_case`), and their names should match exactly (except the case) to the upstream names.
|
||||||
There are a number of helpers to help you correctly implement them:
|
There are a number of helpers to help you correctly implement them:
|
||||||
|
|
||||||
- `helpers.mkPlugin`: This helper is useful for simple plugins that are configured through (vim) global variables.
|
- `helpers.vim-plugin.mkPlugin`: This helper is useful for simple plugins that are configured through (vim) global variables.
|
||||||
- `helpers.defaultNullOpts.{mkBool,mkInt,mkStr,...}`: This family of helpers takes a default value and a description, and sets the Nix default to `null`. These are the main functions you should use to define options.
|
- `helpers.defaultNullOpts.{mkBool,mkInt,mkStr,...}`: This family of helpers takes a default value and a description, and sets the Nix default to `null`. These are the main functions you should use to define options.
|
||||||
- `helpers.defaultNullOpts.mkNullable`: This takes a type, a default and a description. This is useful for more complex options.
|
- `helpers.defaultNullOpts.mkNullable`: This takes a type, a default and a description. This is useful for more complex options.
|
||||||
- `helpers.nixvimTypes.rawLua`: A type to represent raw lua code. The values are of the form `{ __raw = "<code>";}`. This should not be used if the option can only be raw lua code, `mkLua`/`mkLuaFn` should be used in this case.
|
- `helpers.nixvimTypes.rawLua`: A type to represent raw lua code. The values are of the form `{ __raw = "<code>";}`. This should not be used if the option can only be raw lua code, `mkLua`/`mkLuaFn` should be used in this case.
|
||||||
|
|
100
lib/helpers.nix
100
lib/helpers.nix
|
@ -3,6 +3,7 @@ with lib; rec {
|
||||||
maintainers = import ./maintainers.nix;
|
maintainers = import ./maintainers.nix;
|
||||||
keymaps = import ./keymap-helpers.nix {inherit lib;};
|
keymaps = import ./keymap-helpers.nix {inherit lib;};
|
||||||
autocmd = import ./autocmd-helpers.nix {inherit lib;};
|
autocmd = import ./autocmd-helpers.nix {inherit lib;};
|
||||||
|
vim-plugin = import ./vim-plugin.nix {inherit lib mkPackageOption;};
|
||||||
|
|
||||||
# vim dictionaries are, in theory, compatible with JSON
|
# vim dictionaries are, in theory, compatible with JSON
|
||||||
toVimDict = args:
|
toVimDict = args:
|
||||||
|
@ -301,105 +302,6 @@ with lib; rec {
|
||||||
description = "Plugin to use for ${name}";
|
description = "Plugin to use for ${name}";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkPlugin = {
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
name,
|
|
||||||
description ? null,
|
|
||||||
package ? null,
|
|
||||||
extraPlugins ? [],
|
|
||||||
extraPackages ? [],
|
|
||||||
options ? {},
|
|
||||||
globalPrefix ? "",
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.plugins.${name};
|
|
||||||
|
|
||||||
# TODO support nested options!
|
|
||||||
pluginOptions =
|
|
||||||
mapAttrs
|
|
||||||
(
|
|
||||||
optName: opt:
|
|
||||||
opt.option
|
|
||||||
)
|
|
||||||
options;
|
|
||||||
globals =
|
|
||||||
mapAttrs'
|
|
||||||
(optName: opt: {
|
|
||||||
name = let
|
|
||||||
optGlobal =
|
|
||||||
if opt.global == null
|
|
||||||
then optName
|
|
||||||
else opt.global;
|
|
||||||
in
|
|
||||||
globalPrefix + optGlobal;
|
|
||||||
value = cfg.${optName};
|
|
||||||
})
|
|
||||||
options;
|
|
||||||
# does this evaluate package?
|
|
||||||
packageOption =
|
|
||||||
if package == null
|
|
||||||
then {}
|
|
||||||
else {
|
|
||||||
package = mkPackageOption name package;
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfigOption =
|
|
||||||
if (isString globalPrefix) && (globalPrefix != "")
|
|
||||||
then {
|
|
||||||
extraConfig = mkOption {
|
|
||||||
type = with types; attrsOf anything;
|
|
||||||
description = ''
|
|
||||||
The configuration options for ${name} without the '${globalPrefix}' prefix.
|
|
||||||
Example: To set '${globalPrefix}_foo_bar' to 1, write
|
|
||||||
```nix
|
|
||||||
extraConfig = {
|
|
||||||
foo_bar = true;
|
|
||||||
};
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {};
|
|
||||||
in {
|
|
||||||
options.plugins.${name} =
|
|
||||||
{
|
|
||||||
enable = mkEnableOption (
|
|
||||||
if description == null
|
|
||||||
then name
|
|
||||||
else description
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// extraConfigOption
|
|
||||||
// packageOption
|
|
||||||
// pluginOptions;
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
inherit extraPackages globals;
|
|
||||||
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
|
||||||
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkDefaultOpt = {
|
|
||||||
type,
|
|
||||||
global ? null,
|
|
||||||
description ? null,
|
|
||||||
example ? null,
|
|
||||||
default ? null,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
option = mkOption {
|
|
||||||
type = types.nullOr type;
|
|
||||||
inherit default description example;
|
|
||||||
};
|
|
||||||
|
|
||||||
inherit global;
|
|
||||||
};
|
|
||||||
|
|
||||||
extraOptionsOptions = {
|
extraOptionsOptions = {
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
|
104
lib/vim-plugin.nix
Normal file
104
lib/vim-plugin.nix
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
mkPackageOption,
|
||||||
|
}:
|
||||||
|
with lib; {
|
||||||
|
mkPlugin = {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
name,
|
||||||
|
description ? null,
|
||||||
|
package ? null,
|
||||||
|
extraPlugins ? [],
|
||||||
|
extraPackages ? [],
|
||||||
|
options ? {},
|
||||||
|
globalPrefix ? "",
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.${name};
|
||||||
|
|
||||||
|
# TODO support nested options!
|
||||||
|
pluginOptions =
|
||||||
|
mapAttrs
|
||||||
|
(
|
||||||
|
optName: opt:
|
||||||
|
opt.option
|
||||||
|
)
|
||||||
|
options;
|
||||||
|
globals =
|
||||||
|
mapAttrs'
|
||||||
|
(optName: opt: {
|
||||||
|
name = let
|
||||||
|
optGlobal =
|
||||||
|
if opt.global == null
|
||||||
|
then optName
|
||||||
|
else opt.global;
|
||||||
|
in
|
||||||
|
globalPrefix + optGlobal;
|
||||||
|
value = cfg.${optName};
|
||||||
|
})
|
||||||
|
options;
|
||||||
|
# does this evaluate package?
|
||||||
|
packageOption =
|
||||||
|
if package == null
|
||||||
|
then {}
|
||||||
|
else {
|
||||||
|
package = mkPackageOption name package;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfigOption =
|
||||||
|
if (isString globalPrefix) && (globalPrefix != "")
|
||||||
|
then {
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = with types; attrsOf anything;
|
||||||
|
description = ''
|
||||||
|
The configuration options for ${name} without the '${globalPrefix}' prefix.
|
||||||
|
Example: To set '${globalPrefix}_foo_bar' to 1, write
|
||||||
|
```nix
|
||||||
|
extraConfig = {
|
||||||
|
foo_bar = true;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {};
|
||||||
|
in {
|
||||||
|
options.plugins.${name} =
|
||||||
|
{
|
||||||
|
enable = mkEnableOption (
|
||||||
|
if description == null
|
||||||
|
then name
|
||||||
|
else description
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// extraConfigOption
|
||||||
|
// packageOption
|
||||||
|
// pluginOptions;
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
inherit extraPackages globals;
|
||||||
|
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
||||||
|
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mkDefaultOpt = {
|
||||||
|
type,
|
||||||
|
global ? null,
|
||||||
|
description ? null,
|
||||||
|
example ? null,
|
||||||
|
default ? null,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
option = mkOption {
|
||||||
|
type = types.nullOr type;
|
||||||
|
inherit default description example;
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit global;
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
(
|
(
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "copilot-vim";
|
name = "copilot-vim";
|
||||||
description = "copilot.vim";
|
description = "copilot.vim";
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
helpers = import ../../helpers.nix {inherit lib;};
|
helpers = import ../../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib; {
|
with lib; {
|
||||||
mkCmpSourcePlugin = {
|
mkCmpSourcePlugin = {
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "fugitive";
|
name = "fugitive";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "ledger";
|
name = "ledger";
|
||||||
description = "ledger language features";
|
description = "ledger language features";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "markdown-preview";
|
name = "markdown-preview";
|
||||||
description = "markdown-preview.nvim";
|
description = "markdown-preview.nvim";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "nix";
|
name = "nix";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "tagbar";
|
name = "tagbar";
|
||||||
package = pkgs.vimPlugins.tagbar;
|
package = pkgs.vimPlugins.tagbar;
|
||||||
|
|
|
@ -2,122 +2,124 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args: let
|
||||||
with lib;
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
with import ../helpers.nix {inherit lib;};
|
in
|
||||||
mkPlugin args {
|
with lib;
|
||||||
name = "vim-slime";
|
with helpers.vim-plugin;
|
||||||
package = pkgs.vimPlugins.vim-slime;
|
mkPlugin args {
|
||||||
globalPrefix = "slime_";
|
name = "vim-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 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`
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "zig";
|
name = "zig";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "airline";
|
name = "airline";
|
||||||
description = "vim-airline";
|
description = "vim-airline";
|
||||||
|
|
|
@ -11,7 +11,7 @@ with lib; let
|
||||||
in
|
in
|
||||||
either strInt (attrsOf (either strInt (attrsOf strInt)));
|
either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "emmet";
|
name = "emmet";
|
||||||
description = "Enable emmet";
|
description = "Enable emmet";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "endwise";
|
name = "endwise";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "goyo";
|
name = "goyo";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "instant";
|
name = "instant";
|
||||||
description = "instant.nvim";
|
description = "instant.nvim";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "magma-nvim";
|
name = "magma-nvim";
|
||||||
description = "magma-nvim";
|
description = "magma-nvim";
|
||||||
|
|
|
@ -2,208 +2,210 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args: let
|
||||||
with lib;
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
with import ../helpers.nix {inherit lib;};
|
in
|
||||||
mkPlugin args {
|
with lib;
|
||||||
name = "molten";
|
with helpers.vim-plugin;
|
||||||
description = "molten-nvim";
|
mkPlugin args {
|
||||||
package = pkgs.vimPlugins.molten-nvim;
|
name = "molten";
|
||||||
globalPrefix = "molten_";
|
description = "molten-nvim";
|
||||||
|
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 = 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 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with lib;
|
with lib;
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "startify";
|
name = "startify";
|
||||||
description = "Enable startify";
|
description = "Enable startify";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
} @ attrs: let
|
} @ attrs: let
|
||||||
helpers = import ../helpers.nix {inherit lib;};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with helpers;
|
with helpers.vim-plugin;
|
||||||
with lib;
|
with lib;
|
||||||
mkPlugin attrs {
|
mkPlugin attrs {
|
||||||
name = "surround";
|
name = "surround";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib;
|
with lib;
|
||||||
with import ../helpers.nix {inherit lib;};
|
with (import ../helpers.nix {inherit lib;}).vim-plugin;
|
||||||
mkPlugin args {
|
mkPlugin args {
|
||||||
name = "undotree";
|
name = "undotree";
|
||||||
package = pkgs.vimPlugins.undotree;
|
package = pkgs.vimPlugins.undotree;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue