treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -5,208 +5,234 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.clangd-extensions;
basePluginPath = ["plugins" "clangd-extensions"];
basePluginPath = [
"plugins"
"clangd-extensions"
];
borderOpt = helpers.defaultNullOpts.mkBorder "none" "clangd-extensions" "";
in {
in
{
# All of those warnings were introduced on 08/22/2023.
# TODO: Remove them in ~2 months (Oct. 2023).
imports =
[
(
mkRemovedOptionModule
(basePluginPath ++ ["server"])
''
To configure the `clangd` language server options, please use
`plugins.lsp.servers.clangd.extraSettings`.
''
)
(
mkRemovedOptionModule (basePluginPath ++ ["extensions" "autoSetHints"]) ""
)
(mkRemovedOptionModule (basePluginPath ++ [ "server" ]) ''
To configure the `clangd` language server options, please use
`plugins.lsp.servers.clangd.extraSettings`.
'')
(mkRemovedOptionModule (
basePluginPath
++ [
"extensions"
"autoSetHints"
]
) "")
]
++ (
map
++ (map
(
optionPath:
mkRenamedOptionModule
(basePluginPath ++ ["extensions"] ++ optionPath)
(basePluginPath ++ optionPath)
mkRenamedOptionModule (basePluginPath ++ [ "extensions" ] ++ optionPath) (
basePluginPath ++ optionPath
)
)
[
["inlayHints" "inline"]
["inlayHints" "onlyCurrentLine"]
["inlayHints" "onlyCurrentLineAutocmd"]
["inlayHints" "showParameterHints"]
["inlayHints" "parameterHintsPrefix"]
["inlayHints" "otherHintsPrefix"]
["inlayHints" "maxLenAlign"]
["inlayHints" "maxLenAlignPadding"]
["inlayHints" "rightAlign"]
["inlayHints" "rightAlignPadding"]
["inlayHints" "highlight"]
["inlayHints" "priority"]
["ast"]
["memoryUsage"]
["symbolInfo"]
[
"inlayHints"
"inline"
]
[
"inlayHints"
"onlyCurrentLine"
]
[
"inlayHints"
"onlyCurrentLineAutocmd"
]
[
"inlayHints"
"showParameterHints"
]
[
"inlayHints"
"parameterHintsPrefix"
]
[
"inlayHints"
"otherHintsPrefix"
]
[
"inlayHints"
"maxLenAlign"
]
[
"inlayHints"
"maxLenAlignPadding"
]
[
"inlayHints"
"rightAlign"
]
[
"inlayHints"
"rightAlignPadding"
]
[
"inlayHints"
"highlight"
]
[
"inlayHints"
"priority"
]
[ "ast" ]
[ "memoryUsage" ]
[ "symbolInfo" ]
]
);
options.plugins.clangd-extensions =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "clangd_extensions, plugins implementing clangd LSP extensions";
options.plugins.clangd-extensions = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "clangd_extensions, plugins implementing clangd LSP extensions";
package =
helpers.mkPackageOption "clangd_extensions.nvim" pkgs.vimPlugins.clangd_extensions-nvim;
package = helpers.mkPackageOption "clangd_extensions.nvim" pkgs.vimPlugins.clangd_extensions-nvim;
enableOffsetEncodingWorkaround = mkEnableOption ''
utf-16 offset encoding. This is used to work around the warning:
"multiple different client offset_encodings detected for buffer, this is not supported yet"
enableOffsetEncodingWorkaround = mkEnableOption ''
utf-16 offset encoding. This is used to work around the warning:
"multiple different client offset_encodings detected for buffer, this is not supported yet"
'';
inlayHints = {
inline = helpers.defaultNullOpts.mkLua ''vim.fn.has("nvim-0.10") == 1'' ''
Show hints inline.
'';
inlayHints = {
inline = helpers.defaultNullOpts.mkLua ''vim.fn.has("nvim-0.10") == 1'' ''
Show hints inline.
'';
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show inlay hints for the current line";
onlyCurrentLine =
helpers.defaultNullOpts.mkBool false
"Only show inlay hints for the current line";
onlyCurrentLineAutocmd = helpers.defaultNullOpts.mkStr "CursorHold" ''
Event which triggers a refersh of the inlay hints.
You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
not that this may cause higher CPU usage.
This option is only respected when `onlyCurrentLine` is true.
'';
onlyCurrentLineAutocmd = helpers.defaultNullOpts.mkStr "CursorHold" ''
Event which triggers a refersh of the inlay hints.
You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
not that this may cause higher CPU usage.
This option is only respected when `onlyCurrentLine` is true.
'';
showParameterHints = helpers.defaultNullOpts.mkBool true ''
Whether to show parameter hints with the inlay hints or not.
'';
showParameterHints = helpers.defaultNullOpts.mkBool true ''
Whether to show parameter hints with the inlay hints or not.
'';
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "Prefix for parameter hints.";
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "Prefix for parameter hints.";
otherHintsPrefix = helpers.defaultNullOpts.mkStr "=> " "Prefix for all the other hints (type, chaining).";
otherHintsPrefix =
helpers.defaultNullOpts.mkStr "=> "
"Prefix for all the other hints (type, chaining).";
maxLenAlign = helpers.defaultNullOpts.mkBool false ''
Whether to align to the length of the longest line in the file.
'';
maxLenAlign = helpers.defaultNullOpts.mkBool false ''
Whether to align to the length of the longest line in the file.
'';
maxLenAlignPadding = helpers.defaultNullOpts.mkInt 1 ''
Padding from the left if max_len_align is true.
'';
maxLenAlignPadding = helpers.defaultNullOpts.mkInt 1 ''
Padding from the left if max_len_align is true.
'';
rightAlign = helpers.defaultNullOpts.mkBool false ''
Whether to align to the extreme right or not.
'';
rightAlign = helpers.defaultNullOpts.mkBool false ''
Whether to align to the extreme right or not.
'';
rightAlignPadding = helpers.defaultNullOpts.mkInt 7 ''
Padding from the right if right_align is true.
'';
rightAlignPadding = helpers.defaultNullOpts.mkInt 7 ''
Padding from the right if right_align is true.
'';
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints.";
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints.";
priority = helpers.defaultNullOpts.mkInt 100 "The highlight group priority for extmark.";
};
priority = helpers.defaultNullOpts.mkInt 100 "The highlight group priority for extmark.";
ast = {
roleIcons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "") {
type = "🄣";
declaration = "🄓";
expression = "🄔";
statement = ";";
specifier = "🄢";
templateArgument = "🆃";
};
ast = {
roleIcons =
mapAttrs
(name: default: helpers.defaultNullOpts.mkStr default "")
{
type = "🄣";
declaration = "🄓";
expression = "🄔";
statement = ";";
specifier = "🄢";
templateArgument = "🆃";
};
kindIcons =
mapAttrs
(name: default: helpers.defaultNullOpts.mkStr default "")
{
compound = "🄲";
recovery = "🅁";
translationUnit = "🅄";
packExpansion = "🄿";
templateTypeParm = "🅃";
templateTemplateParm = "🅃";
templateParamObject = "🅃";
};
highlights = {
detail = helpers.defaultNullOpts.mkStr "Comment" "";
};
kindIcons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "") {
compound = "🄲";
recovery = "🅁";
translationUnit = "🅄";
packExpansion = "🄿";
templateTypeParm = "🅃";
templateTemplateParm = "🅃";
templateParamObject = "🅃";
};
memoryUsage = {
border = borderOpt;
};
symbolInfo = {
border = borderOpt;
highlights = {
detail = helpers.defaultNullOpts.mkStr "Comment" "";
};
};
config = let
setupOptions = with cfg;
{
inlay_hints = with inlayHints; {
inherit inline;
only_current_line = onlyCurrentLine;
only_current_line_autocmd = onlyCurrentLineAutocmd;
show_parameter_hints = showParameterHints;
parameter_hints_prefix = parameterHintsPrefix;
other_hints_prefix = otherHintsPrefix;
max_len_align = maxLenAlign;
max_len_align_padding = maxLenAlignPadding;
right_align = rightAlign;
right_align_padding = rightAlignPadding;
inherit
highlight
priority
;
};
ast = with ast; {
role_icons = with roleIcons; {
inherit
type
declaration
expression
statement
specifier
;
"template argument" = templateArgument;
memoryUsage = {
border = borderOpt;
};
symbolInfo = {
border = borderOpt;
};
};
config =
let
setupOptions =
with cfg;
{
inlay_hints = with inlayHints; {
inherit inline;
only_current_line = onlyCurrentLine;
only_current_line_autocmd = onlyCurrentLineAutocmd;
show_parameter_hints = showParameterHints;
parameter_hints_prefix = parameterHintsPrefix;
other_hints_prefix = otherHintsPrefix;
max_len_align = maxLenAlign;
max_len_align_padding = maxLenAlignPadding;
right_align = rightAlign;
right_align_padding = rightAlignPadding;
inherit highlight priority;
};
kind_icons = with kindIcons; {
Compound = compound;
Recovery = recovery;
TranslationUnit = translationUnit;
PackExpansion = packExpansion;
TemplateTypeParm = templateTypeParm;
TemplateTemplateParm = templateTemplateParm;
TemplateParamObject = templateParamObject;
ast = with ast; {
role_icons = with roleIcons; {
inherit
type
declaration
expression
statement
specifier
;
"template argument" = templateArgument;
};
kind_icons = with kindIcons; {
Compound = compound;
Recovery = recovery;
TranslationUnit = translationUnit;
PackExpansion = packExpansion;
TemplateTypeParm = templateTypeParm;
TemplateTemplateParm = templateTemplateParm;
TemplateParamObject = templateParamObject;
};
highlights = with highlights; {
inherit detail;
};
};
highlights = with highlights; {
inherit detail;
memory_usage = with memoryUsage; {
inherit border;
};
};
memory_usage = with memoryUsage; {
inherit border;
};
symbol_info = with symbolInfo; {
inherit border;
};
}
// cfg.extraOptions;
in
symbol_info = with symbolInfo; {
inherit border;
};
}
// cfg.extraOptions;
in
mkIf cfg.enable {
warnings = optional (!config.plugins.lsp.enable) ''
You have enabled `clangd-extensions` but not the lsp (`plugins.lsp`).
@ -219,20 +245,19 @@ in {
enable = true;
extraOptions = mkIf cfg.enableOffsetEncodingWorkaround {
capabilities = {__raw = "__clangdCaps";};
capabilities = {
__raw = "__clangdCaps";
};
};
};
preConfig =
optionalString
cfg.enableOffsetEncodingWorkaround
''
local __clangdCaps = vim.lsp.protocol.make_client_capabilities()
__clangdCaps.offsetEncoding = { "utf-16" }
'';
preConfig = optionalString cfg.enableOffsetEncodingWorkaround ''
local __clangdCaps = vim.lsp.protocol.make_client_capabilities()
__clangdCaps.offsetEncoding = { "utf-16" }
'';
};
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.lsp.postConfig = ''
require("clangd_extensions").setup(${helpers.toLuaObject setupOptions})

View file

@ -6,55 +6,47 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "debugprint";
originalName = "debugprint.nvim";
defaultPackage = pkgs.vimPlugins.debugprint-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "debugprint";
originalName = "debugprint.nvim";
defaultPackage = pkgs.vimPlugins.debugprint-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-04-07: remove 2024-06-07
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"moveToDebugline"
"displayCounter"
"displaySnippet"
"ignoreTreesitter"
"printTag"
];
imports = let
basePluginPath = ["plugins" "debugprint"];
in [
(
mkRemovedOptionModule
(basePluginPath ++ ["createCommands"])
''
This option has been deprectaded upstream.
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
''
)
(
mkRemovedOptionModule
(basePluginPath ++ ["createKeymaps"])
''
This option has been deprectaded upstream.
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
''
)
(
mkRemovedOptionModule
(basePluginPath ++ ["filetypes"])
''
Please use `plugins.debugprint.settings.filetypes` instead.
The sub-module options for each filetype are `left`, `right`, `mid_var` and `right_var`.
''
)
# TODO introduced 2024-04-07: remove 2024-06-07
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"moveToDebugline"
"displayCounter"
"displaySnippet"
"ignoreTreesitter"
"printTag"
];
imports =
let
basePluginPath = [
"plugins"
"debugprint"
];
in
[
(mkRemovedOptionModule (basePluginPath ++ [ "createCommands" ]) ''
This option has been deprectaded upstream.
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
'')
(mkRemovedOptionModule (basePluginPath ++ [ "createKeymaps" ]) ''
This option has been deprectaded upstream.
Learn more [here](https://github.com/andrewferrier/debugprint.nvim/blob/796d8d4528bc5882d287b26e69cc8d810a9147c8/doc/debugprint.nvim.txt#L203-L213).
'')
(mkRemovedOptionModule (basePluginPath ++ [ "filetypes" ]) ''
Please use `plugins.debugprint.settings.filetypes` instead.
The sub-module options for each filetype are `left`, `right`, `mid_var` and `right_var`.
'')
];
settingsOptions = {
keymaps =
helpers.defaultNullOpts.mkAttrsOf
(with helpers.nixvimTypes; attrsOf (either str rawLua))
settingsOptions = {
keymaps =
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; attrsOf (either str rawLua))
''
{
normal = {
@ -89,8 +81,8 @@ with lib;
to convert sections to ROT-13, which most folks dont use.
'';
commands =
helpers.defaultNullOpts.mkAttrsOf types.str
commands =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
toggle_comment_debug_prints = "ToggleCommentDebugPrints";
@ -108,45 +100,45 @@ with lib;
Setting any command to `nil` (warning: use `__raw`) will skip it.
'';
move_to_debugline = helpers.defaultNullOpts.mkBool false ''
When adding a debug line, moves the cursor to that line.
'';
move_to_debugline = helpers.defaultNullOpts.mkBool false ''
When adding a debug line, moves the cursor to that line.
'';
display_counter = helpers.defaultNullOpts.mkBool true ''
Whether to display/include the monotonically increasing counter in each debug message.
'';
display_counter = helpers.defaultNullOpts.mkBool true ''
Whether to display/include the monotonically increasing counter in each debug message.
'';
display_snippet = helpers.defaultNullOpts.mkBool true ''
Whether to include a snippet of the line above/below in plain debug lines.
'';
display_snippet = helpers.defaultNullOpts.mkBool true ''
Whether to include a snippet of the line above/below in plain debug lines.
'';
filetypes =
helpers.defaultNullOpts.mkNullable
filetypes =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf (submodule {
options = {
left = mkOption {
type = str;
description = "Left part of snippet to insert.";
};
right = mkOption {
type = str;
description = "Right part of snippet to insert (plain debug line mode).";
};
mid_var = mkOption {
type = str;
description = "Middle part of snippet to insert (variable debug line mode).";
};
right_var = mkOption {
type = str;
description = "Right part of snippet to insert (variable debug line mode).";
};
attrsOf (submodule {
options = {
left = mkOption {
type = str;
description = "Left part of snippet to insert.";
};
})
right = mkOption {
type = str;
description = "Right part of snippet to insert (plain debug line mode).";
};
mid_var = mkOption {
type = str;
description = "Middle part of snippet to insert (variable debug line mode).";
};
right_var = mkOption {
type = str;
description = "Right part of snippet to insert (variable debug line mode).";
};
};
})
)
"{}"
''
@ -168,46 +160,46 @@ with lib;
```
'';
ignore_treesitter = helpers.defaultNullOpts.mkBool false ''
Never use treesitter to find a variable under the cursor, always prompt for it - overrides
the same setting on `debugprint()` if set to true.
'';
ignore_treesitter = helpers.defaultNullOpts.mkBool false ''
Never use treesitter to find a variable under the cursor, always prompt for it - overrides
the same setting on `debugprint()` if set to true.
'';
print_tag = helpers.defaultNullOpts.mkStr "DEBUGPRINT" ''
The string inserted into each print statement, which can be used to uniquely identify
statements inserted by `debugprint`.
'';
};
print_tag = helpers.defaultNullOpts.mkStr "DEBUGPRINT" ''
The string inserted into each print statement, which can be used to uniquely identify
statements inserted by `debugprint`.
'';
};
settingsExample = {
keymaps = {
normal = {
variable_below = "g?v";
variable_above = "g?V";
variable_below_alwaysprompt.__raw = "nil";
variable_above_alwaysprompt.__raw = "nil";
};
visual = {
variable_below = "g?v";
variable_above = "g?V";
};
settingsExample = {
keymaps = {
normal = {
variable_below = "g?v";
variable_above = "g?V";
variable_below_alwaysprompt.__raw = "nil";
variable_above_alwaysprompt.__raw = "nil";
};
commands = {
toggle_comment_debug_prints = "ToggleCommentDebugPrints";
delete_debug_prints = "DeleteDebugPrints";
visual = {
variable_below = "g?v";
variable_above = "g?V";
};
move_to_debugline = false;
display_counter = true;
display_snippet = true;
filetypes = {
python = {
left = "print(f'";
right = "')";
mid_var = "{";
right_var = "}')";
};
};
ignore_treesitter = false;
print_tag = "DEBUGPRINT";
};
}
commands = {
toggle_comment_debug_prints = "ToggleCommentDebugPrints";
delete_debug_prints = "DeleteDebugPrints";
};
move_to_debugline = false;
display_counter = true;
display_snippet = true;
filetypes = {
python = {
left = "print(f'";
right = "')";
mid_var = "{";
right_var = "}')";
};
};
ignore_treesitter = false;
print_tag = "DEBUGPRINT";
};
}

View file

@ -6,36 +6,34 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "godot";
originalName = "vim-godot";
defaultPackage = pkgs.vimPlugins.vim-godot;
globalPrefix = "godot_";
helpers.vim-plugin.mkVimPlugin config {
name = "godot";
originalName = "vim-godot";
defaultPackage = pkgs.vimPlugins.vim-godot;
globalPrefix = "godot_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraOptions = {
godotPackage = mkOption {
type = with types; nullOr package;
default = pkgs.godot_4;
description = ''
Which package to use for `godot`.
Set to `null` to prevent the installation.
'';
};
};
settingsOptions = {
executable = helpers.defaultNullOpts.mkStr "godot" ''
Path to the `godot` executable.
extraOptions = {
godotPackage = mkOption {
type = with types; nullOr package;
default = pkgs.godot_4;
description = ''
Which package to use for `godot`.
Set to `null` to prevent the installation.
'';
};
};
settingsExample = {
executable = "godot";
};
settingsOptions = {
executable = helpers.defaultNullOpts.mkStr "godot" ''
Path to the `godot` executable.
'';
};
extraConfig = cfg: {
extraPackages = [cfg.godotPackage];
};
}
settingsExample = {
executable = "godot";
};
extraConfig = cfg: { extraPackages = [ cfg.godotPackage ]; };
}

View file

@ -6,17 +6,17 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "haskell-scope-highlighting";
originalName = "haskell-scope-highlighting.nvim";
defaultPackage = pkgs.vimPlugins.haskell-scope-highlighting-nvim;
helpers.vim-plugin.mkVimPlugin config {
name = "haskell-scope-highlighting";
originalName = "haskell-scope-highlighting.nvim";
defaultPackage = pkgs.vimPlugins.haskell-scope-highlighting-nvim;
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = _: {
warnings = optional (!config.plugins.treesitter.enable) ''
Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended.
Please, enable it by setting `plugins.treesitter.enable` to `true`.
'';
};
}
extraConfig = _: {
warnings = optional (!config.plugins.treesitter.enable) ''
Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended.
Please, enable it by setting `plugins.treesitter.enable` to `true`.
'';
};
}

View file

@ -5,10 +5,12 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.helm;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.helm = {
enable = mkEnableOption "vim-helm";
@ -16,7 +18,5 @@ in {
package = helpers.mkPackageOption "vim-helm" pkgs.vimPlugins.vim-helm;
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
};
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
}

View file

@ -4,7 +4,8 @@
config,
pkgs,
...
}: let
}:
let
# The keys are the option name in nixvim (under plugins.julia-cell.keymaps)
# cmd: Such that the mapping action is ':JuliaCell${cmd}<CR>'
# desc: The description of the option.
@ -35,66 +36,62 @@
};
};
in
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "julia-cell";
originalName = "vim-julia-cell";
defaultPackage = pkgs.vimPlugins.vim-julia-cell;
globalPrefix = "julia_cell_";
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "julia-cell";
originalName = "vim-julia-cell";
defaultPackage = pkgs.vimPlugins.vim-julia-cell;
globalPrefix = "julia_cell_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-02-19: remove 2024-04-19
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"delimitCellsBy"
"tag"
];
# TODO introduced 2024-02-19: remove 2024-04-19
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"delimitCellsBy"
"tag"
];
settingsOptions = {
delimit_cells_by = helpers.defaultNullOpts.mkEnumFirstDefault ["marks" "tags"] ''
settingsOptions = {
delimit_cells_by =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"marks"
"tags"
]
''
Specifies if cells are delimited by 'marks' or 'tags'.
'';
tag = helpers.defaultNullOpts.mkStr "##" "Specifies the tag format.";
};
tag = helpers.defaultNullOpts.mkStr "##" "Specifies the tag format.";
};
extraOptions = {
keymaps =
{
silent = mkOption {
type = types.bool;
description = "Whether julia-cell keymaps should be silent";
default = false;
};
}
// (
mapAttrs
(
name: value:
helpers.mkNullOrOption types.str "Keymap for ${value.desc}."
)
mappings
);
};
extraOptions = {
keymaps =
{
silent = mkOption {
type = types.bool;
description = "Whether julia-cell keymaps should be silent";
default = false;
};
}
// (mapAttrs (name: value: helpers.mkNullOrOption types.str "Keymap for ${value.desc}.") mappings);
};
extraConfig = cfg: {
keymaps = flatten (
mapAttrsToList
(
name: value: let
key = cfg.keymaps.${name};
in
optional
(key != null)
{
mode = "n";
inherit key;
action = ":JuliaCell${value.cmd}<CR>";
options.silent = cfg.keymaps.silent;
}
)
mappings
);
};
}
extraConfig = cfg: {
keymaps = flatten (
mapAttrsToList (
name: value:
let
key = cfg.keymaps.${name};
in
optional (key != null) {
mode = "n";
inherit key;
action = ":JuliaCell${value.cmd}<CR>";
options.silent = cfg.keymaps.silent;
}
) mappings
);
};
}

View file

@ -5,227 +5,230 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.lean;
in {
options.plugins.lean =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "lean-nvim";
in
{
options.plugins.lean = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "lean-nvim";
package = helpers.mkPackageOption "lean-nvim" pkgs.vimPlugins.lean-nvim;
package = helpers.mkPackageOption "lean-nvim" pkgs.vimPlugins.lean-nvim;
leanPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lean4;
description = "Which package to use for lean.";
example = null;
};
lsp =
helpers.defaultNullOpts.mkNullable
(
with types;
submodule {
freeformType = types.attrs;
options = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the Lean language server(s) ?
Set to `false` to disable, otherwise should be a table of options to pass to
`leanls`.
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
for details.
'';
on_attach = helpers.mkNullOrOption types.str ''
The LSP handler.
'';
init_options = helpers.mkNullOrOption (with types; attrsOf anything) ''
The options to configure the lean language server.
See `Lean.Lsp.InitializationOptions` for details.
'';
};
}
)
"{}"
"LSP settings.";
ft = {
default = helpers.defaultNullOpts.mkStr "lean" ''
The default filetype for Lean files.
'';
nomodifiable = helpers.mkNullOrOption (with types; listOf str) ''
A list of patterns which will be used to protect any matching Lean file paths from being
accidentally modified (by marking the buffer as `nomodifiable`).
By default, this list includes the Lean standard libraries, as well as files within
dependency directories (e.g. `_target`)
Set this to an empty table to disable.
'';
};
abbreviations = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable expanding of unicode abbreviations.
'';
extra = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) "{}" ''
Additional abbreviations.
Example:
```
{
# Add a \wknight abbreviation to insert ♘
#
# Note that the backslash is implied, and that you of
# course may also use a snippet engine directly to do
# this if so desired.
wknight = "";
}
'';
leader = helpers.defaultNullOpts.mkStr "\\" ''
Change if you don't like the backslash.
(comma is a popular choice on French keyboards)
'';
};
mappings = helpers.defaultNullOpts.mkBool false ''
Whether to enable suggested mappings.
'';
infoview = {
autoopen = helpers.defaultNullOpts.mkBool true ''
Automatically open an infoview on entering a Lean buffer?
Should be a function that will be called anytime a new Lean file is opened.
Return true to open an infoview, otherwise false.
Setting this to `true` is the same as `function() return true end`, i.e. autoopen for any
Lean file, or setting it to `false` is the same as `function() return false end`,
i.e. never autoopen.
'';
autopause = helpers.defaultNullOpts.mkBool false "";
width = helpers.defaultNullOpts.mkPositiveInt 50 ''
Set infoview windows' starting width.
Windows are opened horizontally or vertically depending on spacing.
'';
height = helpers.defaultNullOpts.mkPositiveInt 20 ''
Set infoview windows' starting height.
Windows are opened horizontally or vertically depending on spacing.
'';
horizontalPosition = helpers.defaultNullOpts.mkEnum ["top" "bottom"] "bottom" ''
Put the infoview on the top or bottom when horizontal.
'';
separateTab = helpers.defaultNullOpts.mkBool false ''
Always open the infoview window in a separate tabpage.
Might be useful if you are using a screen reader and don't want too many dynamic updates
in the terminal at the same time.
Note that `height` and `width` will be ignored in this case.
'';
indicators = helpers.defaultNullOpts.mkEnum ["always" "never" "auto"] "auto" ''
Show indicators for pin locations when entering an infoview window.
`"auto"` = only when there are multiple pins.
'';
lean3 = {
showFilter = helpers.defaultNullOpts.mkBool true "";
mouseEvents = helpers.defaultNullOpts.mkBool false ''
Setting this to `true` will simulate mouse events in the Lean 3 infoview, this is buggy
at the moment so you can use the I/i keybindings to manually trigger these.
'';
};
showProcessing = helpers.defaultNullOpts.mkBool true "";
showNoInfoMessage = helpers.defaultNullOpts.mkBool false "";
useWidgets = helpers.defaultNullOpts.mkBool true "Whether to use widgets.";
mappings =
helpers.defaultNullOpts.mkNullable
(with types; attrsOf str)
''
{
K = "click";
"<CR>" = "click";
gd = "go_to_def";
gD = "go_to_decl";
gy = "go_to_type";
I = "mouse_enter";
i = "mouse_leave";
"<Esc>" = "clear_all";
C = "clear_all";
"<LocalLeader><Tab>" = "goto_last_window";
}
''
"Mappings.";
};
progressBars = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the progress bars.
'';
priority = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Use a different priority for the signs.
'';
};
stderr = {
enable = helpers.defaultNullOpts.mkBool true ''
Redirect Lean's stderr messages somewhere (to a buffer by default).
'';
height = helpers.defaultNullOpts.mkPositiveInt 5 "Height of the window.";
onLines = helpers.defaultNullOpts.mkLuaFn "nil" ''
A callback which will be called with (multi-line) stderr output.
e.g., use:
```nix
onLines = "function(lines) vim.notify(lines) end";
```
if you want to redirect stderr to `vim.notify`.
The default implementation will redirect to a dedicated stderr
window.
'';
};
lsp3 =
helpers.defaultNullOpts.mkNullable
(
with types;
submodule {
freeformType = types.attrs;
options = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the legacy Lean 3 language server ?
Set to `false` to disable, otherwise should be a table of options to pass to
`lean3ls`.
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lean3ls
for details.
'';
on_attach = helpers.mkNullOrOption types.str "The LSP handler.";
};
}
)
"{}"
"Legacy Lean3 LSP settings.";
leanPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lean4;
description = "Which package to use for lean.";
example = null;
};
lsp = helpers.defaultNullOpts.mkNullable (
with types;
submodule {
freeformType = types.attrs;
options = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the Lean language server(s) ?
Set to `false` to disable, otherwise should be a table of options to pass to
`leanls`.
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
for details.
'';
on_attach = helpers.mkNullOrOption types.str ''
The LSP handler.
'';
init_options = helpers.mkNullOrOption (with types; attrsOf anything) ''
The options to configure the lean language server.
See `Lean.Lsp.InitializationOptions` for details.
'';
};
}
) "{}" "LSP settings.";
ft = {
default = helpers.defaultNullOpts.mkStr "lean" ''
The default filetype for Lean files.
'';
nomodifiable = helpers.mkNullOrOption (with types; listOf str) ''
A list of patterns which will be used to protect any matching Lean file paths from being
accidentally modified (by marking the buffer as `nomodifiable`).
By default, this list includes the Lean standard libraries, as well as files within
dependency directories (e.g. `_target`)
Set this to an empty table to disable.
'';
};
abbreviations = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable expanding of unicode abbreviations.
'';
extra = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) "{}" ''
Additional abbreviations.
Example:
```
{
# Add a \wknight abbreviation to insert ♘
#
# Note that the backslash is implied, and that you of
# course may also use a snippet engine directly to do
# this if so desired.
wknight = "";
}
'';
leader = helpers.defaultNullOpts.mkStr "\\" ''
Change if you don't like the backslash.
(comma is a popular choice on French keyboards)
'';
};
mappings = helpers.defaultNullOpts.mkBool false ''
Whether to enable suggested mappings.
'';
infoview = {
autoopen = helpers.defaultNullOpts.mkBool true ''
Automatically open an infoview on entering a Lean buffer?
Should be a function that will be called anytime a new Lean file is opened.
Return true to open an infoview, otherwise false.
Setting this to `true` is the same as `function() return true end`, i.e. autoopen for any
Lean file, or setting it to `false` is the same as `function() return false end`,
i.e. never autoopen.
'';
autopause = helpers.defaultNullOpts.mkBool false "";
width = helpers.defaultNullOpts.mkPositiveInt 50 ''
Set infoview windows' starting width.
Windows are opened horizontally or vertically depending on spacing.
'';
height = helpers.defaultNullOpts.mkPositiveInt 20 ''
Set infoview windows' starting height.
Windows are opened horizontally or vertically depending on spacing.
'';
horizontalPosition =
helpers.defaultNullOpts.mkEnum
[
"top"
"bottom"
]
"bottom"
''
Put the infoview on the top or bottom when horizontal.
'';
separateTab = helpers.defaultNullOpts.mkBool false ''
Always open the infoview window in a separate tabpage.
Might be useful if you are using a screen reader and don't want too many dynamic updates
in the terminal at the same time.
Note that `height` and `width` will be ignored in this case.
'';
indicators =
helpers.defaultNullOpts.mkEnum
[
"always"
"never"
"auto"
]
"auto"
''
Show indicators for pin locations when entering an infoview window.
`"auto"` = only when there are multiple pins.
'';
lean3 = {
showFilter = helpers.defaultNullOpts.mkBool true "";
mouseEvents = helpers.defaultNullOpts.mkBool false ''
Setting this to `true` will simulate mouse events in the Lean 3 infoview, this is buggy
at the moment so you can use the I/i keybindings to manually trigger these.
'';
};
showProcessing = helpers.defaultNullOpts.mkBool true "";
showNoInfoMessage = helpers.defaultNullOpts.mkBool false "";
useWidgets = helpers.defaultNullOpts.mkBool true "Whether to use widgets.";
mappings = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) ''
{
K = "click";
"<CR>" = "click";
gd = "go_to_def";
gD = "go_to_decl";
gy = "go_to_type";
I = "mouse_enter";
i = "mouse_leave";
"<Esc>" = "clear_all";
C = "clear_all";
"<LocalLeader><Tab>" = "goto_last_window";
}
'' "Mappings.";
};
progressBars = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the progress bars.
'';
priority = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Use a different priority for the signs.
'';
};
stderr = {
enable = helpers.defaultNullOpts.mkBool true ''
Redirect Lean's stderr messages somewhere (to a buffer by default).
'';
height = helpers.defaultNullOpts.mkPositiveInt 5 "Height of the window.";
onLines = helpers.defaultNullOpts.mkLuaFn "nil" ''
A callback which will be called with (multi-line) stderr output.
e.g., use:
```nix
onLines = "function(lines) vim.notify(lines) end";
```
if you want to redirect stderr to `vim.notify`.
The default implementation will redirect to a dedicated stderr
window.
'';
};
lsp3 = helpers.defaultNullOpts.mkNullable (
with types;
submodule {
freeformType = types.attrs;
options = {
enable = helpers.defaultNullOpts.mkBool true ''
Whether to enable the legacy Lean 3 language server ?
Set to `false` to disable, otherwise should be a table of options to pass to
`lean3ls`.
See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lean3ls
for details.
'';
on_attach = helpers.mkNullOrOption types.str "The LSP handler.";
};
}
) "{}" "Legacy Lean3 LSP settings.";
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
assertions = [
{
@ -236,8 +239,7 @@ in {
# lsp is not (!) disabled in the lean.nvim plugin
&& !(
# lsp is explicitly set to `false`.
(isBool cfg.lsp.enable)
&& !cfg.lsp.enable
(isBool cfg.lsp.enable) && !cfg.lsp.enable
)
);
message = ''
@ -252,63 +254,53 @@ in {
}
];
extraPackages = [cfg.leanPackage];
extraPackages = [ cfg.leanPackage ];
extraConfigLua = let
setupOptions = with cfg;
{
inherit lsp;
ft = with ft; {
inherit
default
nomodifiable
;
};
abbreviations = with abbreviations; {
inherit
enable
extra
leader
;
};
inherit mappings;
infoview = with infoview; {
inherit
autoopen
autopause
width
height
;
horizontal_position = horizontalPosition;
separate_tab = separateTab;
inherit indicators;
lean3 = with lean3; {
show_filter = showFilter;
mouse_events = mouseEvents;
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit lsp;
ft = with ft; {
inherit default nomodifiable;
};
abbreviations = with abbreviations; {
inherit enable extra leader;
};
show_processing = showProcessing;
show_no_info_message = showNoInfoMessage;
use_widgets = useWidgets;
inherit mappings;
};
progress_bars = with progressBars; {
inherit
enable
priority
;
};
stderr = with stderr; {
inherit
enable
height
;
on_lines = onLines;
};
inherit lsp3;
}
// cfg.extraOptions;
in ''
require("lean").setup(${helpers.toLuaObject setupOptions})
'';
infoview = with infoview; {
inherit
autoopen
autopause
width
height
;
horizontal_position = horizontalPosition;
separate_tab = separateTab;
inherit indicators;
lean3 = with lean3; {
show_filter = showFilter;
mouse_events = mouseEvents;
};
show_processing = showProcessing;
show_no_info_message = showNoInfoMessage;
use_widgets = useWidgets;
inherit mappings;
};
progress_bars = with progressBars; {
inherit enable priority;
};
stderr = with stderr; {
inherit enable height;
on_lines = onLines;
};
inherit lsp3;
}
// cfg.extraOptions;
in
''
require("lean").setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -7,211 +7,218 @@
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "ledger";
originalName = "vim-ledger";
defaultPackage = pkgs.vimPlugins.vim-ledger;
globalPrefix = "ledger_";
mkVimPlugin config {
name = "ledger";
originalName = "vim-ledger";
defaultPackage = pkgs.vimPlugins.vim-ledger;
globalPrefix = "ledger_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"detailedFirst"
"foldBlanks"
];
imports = let
basePluginPath = ["plugins" "ledger"];
in [
(
mkRenamedOptionModule
(basePluginPath ++ ["maxWidth"])
(basePluginPath ++ ["settings" "maxwidth"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["fillString"])
(basePluginPath ++ ["settings" "fillstring"])
)
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"detailedFirst"
"foldBlanks"
];
imports =
let
basePluginPath = [
"plugins"
"ledger"
];
in
[
(mkRenamedOptionModule (basePluginPath ++ [ "maxWidth" ]) (
basePluginPath
++ [
"settings"
"maxwidth"
]
))
(mkRenamedOptionModule (basePluginPath ++ [ "fillString" ]) (
basePluginPath
++ [
"settings"
"fillstring"
]
))
];
extraOptions = {
ledgerPackage = mkOption {
type = with types; nullOr package;
default = pkgs.ledger;
description = ''
The package to install for `ledger`.
Set to `null` for disabling installation.
'';
};
};
extraConfig = cfg: {
extraPackages = [cfg.ledgerPackage];
};
settingsOptions = {
bin = helpers.mkNullOrStr ''
Path to the `ledger` executable.
'';
is_hledger = helpers.mkNullOrOption types.bool ''
Whether to use ledger or hledger specific features.
Setting this value is optional and in most coses will be guessed correctly based on `bin`,
but in the event it isn't guessed correctly or you want to use different syntax features
even with your default tooling setup for the other engine this flag can be set to override
the value.
'';
extra_options = helpers.defaultNullOpts.mkStr "" ''
Additional default options for the `ledger` executable.
'';
accounts_cmd = helpers.mkNullOrStr ''
To use a custom external system command to generate a list of account names for completion,
set the following.
If `bin` is set, this will default to running that command with arguments to parse the
current file using the accounts subcommand (works with ledger or hledger), otherwise it will
parse the postings in the current file itself.
'';
descriptions_cmd = helpers.mkNullOrStr ''
To use a custom external system command to generate a list of descriptions for completion,
set the following.
If `bin` is set, this will default to running that command with arguments to parse the
current file using the descriptions subcommand (works with ledger or hledger), otherwise it
will parse the transactions in the current file itself.
'';
maxwidth = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Number of columns that will be used to display the foldtext.
Set this when you think that the amount is too far off to the right.
When `maxwidth` is zero, the amount will be displayed at the far right side of the screen.
'';
fillstring = helpers.defaultNullOpts.mkStr " " ''
String that will be used to fill the space between account name and amount in the foldtext.
Set this to get some kind of lines or visual aid.
'';
detailed_first = helpers.defaultNullOpts.mkBool true ''
If you want the account completion to be sorted by level of detail/depth instead of
alphabetical, set this option to `true`.
'';
fold_blanks = helpers.defaultNullOpts.mkBool false ''
By default vim will fold ledger transactions, leaving surrounding blank lines unfolded.
You can use this option to hide blank lines following a transaction.
A value of `false` will disable folding of blank lines, `true` will allow folding of a
single blank line between transactions; any larger value will enable folding
unconditionally.
Note that only lines containing no trailing spaces are considered for folding.
You can take advantage of this to disable this feature on a case-by-case basis.
'';
decimal_sep = helpers.defaultNullOpts.mkStr "." ''
Decimal separator.
'';
align_last = helpers.defaultNullOpts.mkBool false ''
Specify alignment on first or last matching separator.
'';
align_at = helpers.defaultNullOpts.mkUnsignedInt 60 ''
Specify at which column decimal separators should be aligned.
'';
default_commodity = helpers.defaultNullOpts.mkStr "" ''
Default commodity used by `ledger#align_amount_at_cursor()`.
'';
align_commodity = helpers.defaultNullOpts.mkBool false ''
Align on the commodity location instead of the amount
'';
commodity_before = helpers.defaultNullOpts.mkBool true ''
Flag that tells whether the commodity should be prepended or appended to the amount.
'';
commodity_sep = helpers.defaultNullOpts.mkStr "" ''
String to be put between the commodity and the amount:
'';
commodity_spell = helpers.defaultNullOpts.mkBool false ''
Flag that enable the spelling of the amount.
'';
date_format = helpers.defaultNullOpts.mkStr "%Y/%m/%d" ''
Format of transaction date.
'';
main = helpers.defaultNullOpts.mkStr "%" ''
The file to be used to generate reports.
The default is to use the current file.
'';
winpos = helpers.defaultNullOpts.mkStr "B" ''
Position of a report buffer.
Use `b` for bottom, `t` for top, `l` for left, `r` for right.
Use uppercase letters if you want the window to always occupy the full width or height.
'';
qf_register_format = helpers.mkNullOrStr ''
Format of quickfix register reports (see `|:Register|`).
The format is specified using the standard Ledger syntax for `--format`.
'';
qf_reconcile_format = helpers.mkNullOrStr ''
Format of the reconcile quickfix window (see `|:Reconcile|`).
The format is specified using the standard Ledger syntax for `--format`.
'';
use_location_list = helpers.defaultNullOpts.mkBool false ''
Flag that tells whether a location list or a quickfix list should be used:
The default is to use the quickfix window.
Set to `true` to use a location list.
'';
qf_vertical = helpers.defaultNullOpts.mkBool false ''
Position of the quickfix/location list.
Set to `true` to open the quickfix window in a vertical split.
'';
qf_size = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Size of the quickfix window.
This is the number of lines of a horizontal quickfix window, or the number of columns of a
vertical quickfix window.
'';
qf_hide_file = helpers.defaultNullOpts.mkBool true ''
Flag to show or hide filenames in the quickfix window:
Filenames in the quickfix window are hidden by default. Set this to 1 is
you want filenames to be visible.
'';
cleared_string = helpers.defaultNullOpts.mkStr "Cleared: " ''
Text of the output of the `|:Balance|` command.
'';
pending_string = helpers.defaultNullOpts.mkStr "Cleared or pending: " ''
Text of the output of the `|:Balance|` command.
'';
target_string = helpers.defaultNullOpts.mkStr "Difference from target: " ''
Text of the output of the `|:Balance|` command.
extraOptions = {
ledgerPackage = mkOption {
type = with types; nullOr package;
default = pkgs.ledger;
description = ''
The package to install for `ledger`.
Set to `null` for disabling installation.
'';
};
};
settingsExample = {
detailed_first = true;
fold_blanks = false;
maxwidth = 80;
fillstring = " ";
};
}
extraConfig = cfg: { extraPackages = [ cfg.ledgerPackage ]; };
settingsOptions = {
bin = helpers.mkNullOrStr ''
Path to the `ledger` executable.
'';
is_hledger = helpers.mkNullOrOption types.bool ''
Whether to use ledger or hledger specific features.
Setting this value is optional and in most coses will be guessed correctly based on `bin`,
but in the event it isn't guessed correctly or you want to use different syntax features
even with your default tooling setup for the other engine this flag can be set to override
the value.
'';
extra_options = helpers.defaultNullOpts.mkStr "" ''
Additional default options for the `ledger` executable.
'';
accounts_cmd = helpers.mkNullOrStr ''
To use a custom external system command to generate a list of account names for completion,
set the following.
If `bin` is set, this will default to running that command with arguments to parse the
current file using the accounts subcommand (works with ledger or hledger), otherwise it will
parse the postings in the current file itself.
'';
descriptions_cmd = helpers.mkNullOrStr ''
To use a custom external system command to generate a list of descriptions for completion,
set the following.
If `bin` is set, this will default to running that command with arguments to parse the
current file using the descriptions subcommand (works with ledger or hledger), otherwise it
will parse the transactions in the current file itself.
'';
maxwidth = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Number of columns that will be used to display the foldtext.
Set this when you think that the amount is too far off to the right.
When `maxwidth` is zero, the amount will be displayed at the far right side of the screen.
'';
fillstring = helpers.defaultNullOpts.mkStr " " ''
String that will be used to fill the space between account name and amount in the foldtext.
Set this to get some kind of lines or visual aid.
'';
detailed_first = helpers.defaultNullOpts.mkBool true ''
If you want the account completion to be sorted by level of detail/depth instead of
alphabetical, set this option to `true`.
'';
fold_blanks = helpers.defaultNullOpts.mkBool false ''
By default vim will fold ledger transactions, leaving surrounding blank lines unfolded.
You can use this option to hide blank lines following a transaction.
A value of `false` will disable folding of blank lines, `true` will allow folding of a
single blank line between transactions; any larger value will enable folding
unconditionally.
Note that only lines containing no trailing spaces are considered for folding.
You can take advantage of this to disable this feature on a case-by-case basis.
'';
decimal_sep = helpers.defaultNullOpts.mkStr "." ''
Decimal separator.
'';
align_last = helpers.defaultNullOpts.mkBool false ''
Specify alignment on first or last matching separator.
'';
align_at = helpers.defaultNullOpts.mkUnsignedInt 60 ''
Specify at which column decimal separators should be aligned.
'';
default_commodity = helpers.defaultNullOpts.mkStr "" ''
Default commodity used by `ledger#align_amount_at_cursor()`.
'';
align_commodity = helpers.defaultNullOpts.mkBool false ''
Align on the commodity location instead of the amount
'';
commodity_before = helpers.defaultNullOpts.mkBool true ''
Flag that tells whether the commodity should be prepended or appended to the amount.
'';
commodity_sep = helpers.defaultNullOpts.mkStr "" ''
String to be put between the commodity and the amount:
'';
commodity_spell = helpers.defaultNullOpts.mkBool false ''
Flag that enable the spelling of the amount.
'';
date_format = helpers.defaultNullOpts.mkStr "%Y/%m/%d" ''
Format of transaction date.
'';
main = helpers.defaultNullOpts.mkStr "%" ''
The file to be used to generate reports.
The default is to use the current file.
'';
winpos = helpers.defaultNullOpts.mkStr "B" ''
Position of a report buffer.
Use `b` for bottom, `t` for top, `l` for left, `r` for right.
Use uppercase letters if you want the window to always occupy the full width or height.
'';
qf_register_format = helpers.mkNullOrStr ''
Format of quickfix register reports (see `|:Register|`).
The format is specified using the standard Ledger syntax for `--format`.
'';
qf_reconcile_format = helpers.mkNullOrStr ''
Format of the reconcile quickfix window (see `|:Reconcile|`).
The format is specified using the standard Ledger syntax for `--format`.
'';
use_location_list = helpers.defaultNullOpts.mkBool false ''
Flag that tells whether a location list or a quickfix list should be used:
The default is to use the quickfix window.
Set to `true` to use a location list.
'';
qf_vertical = helpers.defaultNullOpts.mkBool false ''
Position of the quickfix/location list.
Set to `true` to open the quickfix window in a vertical split.
'';
qf_size = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Size of the quickfix window.
This is the number of lines of a horizontal quickfix window, or the number of columns of a
vertical quickfix window.
'';
qf_hide_file = helpers.defaultNullOpts.mkBool true ''
Flag to show or hide filenames in the quickfix window:
Filenames in the quickfix window are hidden by default. Set this to 1 is
you want filenames to be visible.
'';
cleared_string = helpers.defaultNullOpts.mkStr "Cleared: " ''
Text of the output of the `|:Balance|` command.
'';
pending_string = helpers.defaultNullOpts.mkStr "Cleared or pending: " ''
Text of the output of the `|:Balance|` command.
'';
target_string = helpers.defaultNullOpts.mkStr "Difference from target: " ''
Text of the output of the `|:Balance|` command.
'';
};
settingsExample = {
detailed_first = true;
fold_blanks = false;
maxwidth = 80;
fillstring = " ";
};
}

View file

@ -5,7 +5,8 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.lint;
linterOptions = with types; {
@ -50,7 +51,11 @@ with lib; let
};
stream = {
type = enum ["stdout" "stderr" "both"];
type = enum [
"stdout"
"stderr"
"both"
];
description = ''
configure the stream to which the linter outputs the linting result.
@ -91,117 +96,104 @@ with lib; let
};
};
mkLinterOpts = noDefaults:
mkLinterOpts =
noDefaults:
types.submodule {
freeformType = types.attrs;
options =
mapAttrs
options = mapAttrs (
optionName:
(
optionName: (
{
mandatory ? false,
apply ? x: x,
example ? null,
type,
description,
}:
mkOption (
{
mandatory ? false,
apply ? x: x,
example ? null,
type,
description,
}:
mkOption (
inherit apply description example;
}
// (
if
noDefaults && mandatory
# Make this option mandatory
then
{ inherit type; }
# make it optional
else
{
inherit
apply
description
example
;
type = types.nullOr type;
default = null;
}
// (
if noDefaults && mandatory
# Make this option mandatory
then {
inherit type;
}
# make it optional
else {
type = types.nullOr type;
default = null;
}
)
)
)
)
)
linterOptions;
) linterOptions;
};
in {
options.plugins.lint =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "nvim-lint";
in
{
options.plugins.lint = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-lint";
package = helpers.mkPackageOption "nvim-lint" pkgs.vimPlugins.nvim-lint;
package = helpers.mkPackageOption "nvim-lint" pkgs.vimPlugins.nvim-lint;
lintersByFt = mkOption {
type = with types; attrsOf (listOf str);
default = {};
description = ''
Configure the linters you want to run per file type.
lintersByFt = mkOption {
type = with types; attrsOf (listOf str);
default = { };
description = ''
Configure the linters you want to run per file type.
Default:
```nix
{
text = ["vale"];
json = ["jsonlint"];
markdown = ["vale"];
rst = ["vale"];
ruby = ["ruby"];
janet = ["janet"];
inko = ["inko"];
clojure = ["clj-kondo"];
dockerfile = ["hadolint"];
terraform = ["tflint"];
}
```
'';
example = {
markdown = ["vale"];
};
Default:
```nix
{
text = ["vale"];
json = ["jsonlint"];
markdown = ["vale"];
rst = ["vale"];
ruby = ["ruby"];
janet = ["janet"];
inko = ["inko"];
clojure = ["clj-kondo"];
dockerfile = ["hadolint"];
terraform = ["tflint"];
}
```
'';
example = {
markdown = [ "vale" ];
};
};
linters = mkOption {
type = with types;
attrsOf
(mkLinterOpts false);
default = {};
description = ''
Customize the existing linters by overriding some of their properties.
'';
example = {
phpcs.args = [
"-q"
"--report=json"
"-"
];
};
linters = mkOption {
type = with types; attrsOf (mkLinterOpts false);
default = { };
description = ''
Customize the existing linters by overriding some of their properties.
'';
example = {
phpcs.args = [
"-q"
"--report=json"
"-"
];
};
};
customLinters = mkOption {
type = with types;
attrsOf
(
either
str
(mkLinterOpts true)
);
default = {};
description = ''
Configure the linters you want to run per file type.
It can be both an attrs or a string containing the lua code that returns the appropriate
table.
'';
example = {
};
};
customLinters = mkOption {
type = with types; attrsOf (either str (mkLinterOpts true));
default = { };
description = ''
Configure the linters you want to run per file type.
It can be both an attrs or a string containing the lua code that returns the appropriate
table.
'';
example = { };
};
autoCmd = let
autoCmd =
let
defaultEvent = "BufWritePost";
defaultCallback = helpers.mkRaw ''
function()
@ -209,93 +201,69 @@ in {
end
'';
in
mkOption {
type = with types;
nullOr (submodule {
options =
helpers.autocmd.autoCmdOptions
// {
event = mkOption {
type = with types;
nullOr
(
either
str
(listOf str)
);
default = defaultEvent;
description = "The event or events that should trigger linting.";
};
mkOption {
type =
with types;
nullOr (submodule {
options = helpers.autocmd.autoCmdOptions // {
event = mkOption {
type = with types; nullOr (either str (listOf str));
default = defaultEvent;
description = "The event or events that should trigger linting.";
};
callback = mkOption {
type = with types;
nullOr (either str helpers.nixvimTypes.rawLua);
default = defaultCallback;
description = "What action to perform for linting";
};
};
});
description = ''
The configuration for the linting autocommand.
You can disable it by setting this option to `null`.
'';
default = {
event = defaultEvent;
callback = defaultCallback;
};
callback = mkOption {
type = with types; nullOr (either str helpers.nixvimTypes.rawLua);
default = defaultCallback;
description = "What action to perform for linting";
};
};
});
description = ''
The configuration for the linting autocommand.
You can disable it by setting this option to `null`.
'';
default = {
event = defaultEvent;
callback = defaultCallback;
};
};
};
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua =
''
__lint = require('lint')
__lint.linters_by_ft = ${helpers.toLuaObject cfg.lintersByFt}
''
+ (
optionalString
(cfg.linters != {})
(
concatLines
(
flatten
(
mapAttrsToList
(
linter: linterConfig:
mapAttrsToList
(
propName: propValue:
optionalString
(propValue != null)
"__lint.linters.${linter}.${propName} = ${helpers.toLuaObject propValue}"
)
linterConfig
)
cfg.linters
)
+ (optionalString (cfg.linters != { }) (
concatLines (
flatten (
mapAttrsToList (
linter: linterConfig:
mapAttrsToList (
propName: propValue:
optionalString (
propValue != null
) "__lint.linters.${linter}.${propName} = ${helpers.toLuaObject propValue}"
) linterConfig
) cfg.linters
)
)
)
+ (
optionalString
(cfg.customLinters != {})
(
concatLines
(
mapAttrsToList
(customLinter: linterConfig: let
linterConfig' =
if isString linterConfig
then helpers.mkRaw linterConfig
else linterConfig;
in "__lint.linters.${customLinter} = ${helpers.toLuaObject linterConfig'}")
cfg.customLinters
)
))
+ (optionalString (cfg.customLinters != { }) (
concatLines (
mapAttrsToList (
customLinter: linterConfig:
let
linterConfig' = if isString linterConfig then helpers.mkRaw linterConfig else linterConfig;
in
"__lint.linters.${customLinter} = ${helpers.toLuaObject linterConfig'}"
) cfg.customLinters
)
);
));
autoCmd = optional (cfg.autoCmd != null) cfg.autoCmd;
};

View file

@ -6,69 +6,72 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ltex-extra";
originalName = "ltex_extra.nvim";
defaultPackage = pkgs.vimPlugins.ltex_extra-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ltex-extra";
originalName = "ltex_extra.nvim";
defaultPackage = pkgs.vimPlugins.ltex_extra-nvim;
maintainers = [maintainers.loicreynier];
maintainers = [ maintainers.loicreynier ];
callSetup = false;
callSetup = false;
settingsOptions = {
path = helpers.defaultNullOpts.mkStr "" ''
Path (relative to project root) to load external files from.
settingsOptions = {
path = helpers.defaultNullOpts.mkStr "" ''
Path (relative to project root) to load external files from.
Commonly used values are:
- `.ltex`
- `.vscode` for compatibility with projects using the associated VS Code extension.
'';
Commonly used values are:
- `.ltex`
- `.vscode` for compatibility with projects using the associated VS Code extension.
'';
init_check = helpers.defaultNullOpts.mkBool true ''
Whether to load dictionaries on startup.
'';
init_check = helpers.defaultNullOpts.mkBool true ''
Whether to load dictionaries on startup.
'';
load_langs = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["en-US"]'' ''
Languages for witch dicionnaries will be loaded.
See `plugins.lsp.servers.ltex.languages` for possible values.
'';
load_langs = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["en-US"]'' ''
Languages for witch dicionnaries will be loaded.
See `plugins.lsp.servers.ltex.languages` for possible values.
'';
log_level = helpers.defaultNullOpts.mkStr "none" ''
Log level. Possible values:
- "none"
- "trace"
- "debug"
- "info"
- "warn"
- "error"
- "fatal"
'';
};
log_level = helpers.defaultNullOpts.mkStr "none" ''
Log level. Possible values:
- "none"
- "trace"
- "debug"
- "info"
- "warn"
- "error"
- "fatal"
'';
};
extraConfig = cfg: {
warnings = optional (!config.plugins.lsp.enable) ''
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
'';
extraConfig = cfg: {
warnings = optional (!config.plugins.lsp.enable) ''
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
'';
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.lsp = {
servers.ltex = {
# Enable the ltex language server
enable = true;
plugins.lsp = {
servers.ltex = {
# Enable the ltex language server
enable = true;
onAttach.function = ''
require("ltex_extra").setup(${helpers.toLuaObject cfg.settings})
'';
};
onAttach.function = ''
require("ltex_extra").setup(${helpers.toLuaObject cfg.settings})
'';
};
};
};
settingsExample = {
path = ".ltex";
initCheck = true;
loadLangs = ["en-US" "fr-FR"];
logLevel = "non";
};
}
settingsExample = {
path = ".ltex";
initCheck = true;
loadLangs = [
"en-US"
"fr-FR"
];
logLevel = "non";
};
}

View file

@ -7,209 +7,222 @@
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "markdown-preview";
originalName = "markdown-preview.nvim";
defaultPackage = pkgs.vimPlugins.markdown-preview-nvim;
globalPrefix = "mkdp_";
mkVimPlugin config {
name = "markdown-preview";
originalName = "markdown-preview.nvim";
defaultPackage = pkgs.vimPlugins.markdown-preview-nvim;
globalPrefix = "mkdp_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"autoStart"
"autoClose"
"refreshSlow"
"commandForGlobal"
"openToTheWorld"
"openIp"
"browser"
"echoPreviewUrl"
"browserFunc"
"previewOptions"
"markdownCss"
"highlightCss"
"port"
"pageTitle"
"theme"
];
imports = [
(
mkRenamedOptionModule
["plugins" "markdown-preview" "fileTypes"]
["plugins" "markdown-preview" "settings" "filetypes"]
)
];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"autoStart"
"autoClose"
"refreshSlow"
"commandForGlobal"
"openToTheWorld"
"openIp"
"browser"
"echoPreviewUrl"
"browserFunc"
"previewOptions"
"markdownCss"
"highlightCss"
"port"
"pageTitle"
"theme"
];
imports = [
(mkRenamedOptionModule
[
"plugins"
"markdown-preview"
"fileTypes"
]
[
"plugins"
"markdown-preview"
"settings"
"filetypes"
]
)
];
settingsOptions = {
auto_start = helpers.defaultNullOpts.mkBool false ''
Open the preview window after entering the markdown buffer.
'';
settingsOptions = {
auto_start = helpers.defaultNullOpts.mkBool false ''
Open the preview window after entering the markdown buffer.
'';
auto_close = helpers.defaultNullOpts.mkBool true ''
Auto close current preview window when change from markdown buffer to another buffer.
'';
auto_close = helpers.defaultNullOpts.mkBool true ''
Auto close current preview window when change from markdown buffer to another buffer.
'';
refresh_slow = helpers.defaultNullOpts.mkBool false ''
Refresh markdown when save the buffer or leave from insert mode, default false is auto
refresh markdown as you edit or move the cursor.
'';
refresh_slow = helpers.defaultNullOpts.mkBool false ''
Refresh markdown when save the buffer or leave from insert mode, default false is auto
refresh markdown as you edit or move the cursor.
'';
command_for_global = helpers.defaultNullOpts.mkBool false ''
Enable markdown preview for all files (by default, the plugin is only enabled for markdown
files).
'';
command_for_global = helpers.defaultNullOpts.mkBool false ''
Enable markdown preview for all files (by default, the plugin is only enabled for markdown
files).
'';
open_to_the_world = helpers.defaultNullOpts.mkBool false ''
Make the preview server available to others in your network.
By default, the server listens on localhost (127.0.0.1).
'';
open_to_the_world = helpers.defaultNullOpts.mkBool false ''
Make the preview server available to others in your network.
By default, the server listens on localhost (127.0.0.1).
'';
open_ip = helpers.defaultNullOpts.mkStr "" ''
Custom IP used to open the preview page.
This can be useful when you work in remote vim and preview on local browser.
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
'';
open_ip = helpers.defaultNullOpts.mkStr "" ''
Custom IP used to open the preview page.
This can be useful when you work in remote vim and preview on local browser.
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
'';
browser = helpers.defaultNullOpts.mkStr "" ''
The browser to open the preview page.
'';
browser = helpers.defaultNullOpts.mkStr "" ''
The browser to open the preview page.
'';
echo_preview_url = helpers.defaultNullOpts.mkBool false ''
Echo preview page url in command line when opening the preview page.
'';
echo_preview_url = helpers.defaultNullOpts.mkBool false ''
Echo preview page url in command line when opening the preview page.
'';
browser_func = helpers.defaultNullOpts.mkStr "" ''
A custom vim function name to open preview page.
This function will receive url as param.
'';
browser_func = helpers.defaultNullOpts.mkStr "" ''
A custom vim function name to open preview page.
This function will receive url as param.
'';
preview_options =
helpers.mkNullOrOption
(
types.submodule {
freeformType = types.attrs;
preview_options = helpers.mkNullOrOption (types.submodule {
freeformType = types.attrs;
options = {
mkit = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`markdown-it` options for render.
'';
options = {
mkit = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`markdown-it` options for render.
'';
katex = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`katex` options for math.
'';
katex = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`katex` options for math.
'';
uml = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`markdown-it-plantuml` options.
'';
uml = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`markdown-it-plantuml` options.
'';
maid = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`mermaid` options.
'';
maid = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`mermaid` options.
'';
disable_sync_scroll = helpers.defaultNullOpts.mkBool false ''
Disable sync scroll.
'';
disable_sync_scroll = helpers.defaultNullOpts.mkBool false ''
Disable sync scroll.
'';
sync_scroll_type =
helpers.defaultNullOpts.mkEnumFirstDefault
["middle" "top" "relative"]
''
Scroll type:
- "middle": The cursor position is always shown at the middle of the preview page.
- "top": The vim top viewport is always shown at the top of the preview page.
- "relative": The cursor position is always shown at the relative position of the preview page.
'';
sync_scroll_type =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"middle"
"top"
"relative"
]
''
Scroll type:
- "middle": The cursor position is always shown at the middle of the preview page.
- "top": The vim top viewport is always shown at the top of the preview page.
- "relative": The cursor position is always shown at the relative position of the preview page.
'';
hide_yaml_meta = helpers.defaultNullOpts.mkBool true ''
Hide yaml metadata.
'';
hide_yaml_meta = helpers.defaultNullOpts.mkBool true ''
Hide yaml metadata.
'';
sequence_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`js-sequence-diagrams` options.
'';
sequence_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`js-sequence-diagrams` options.
'';
flowchart_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`flowcharts` diagrams options.
'';
flowchart_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
`flowcharts` diagrams options.
'';
content_editable = helpers.defaultNullOpts.mkBool false ''
Content editable from the preview page.
'';
content_editable = helpers.defaultNullOpts.mkBool false ''
Content editable from the preview page.
'';
disable_filename = helpers.defaultNullOpts.mkBool false ''
Disable filename header for the preview page.
'';
disable_filename = helpers.defaultNullOpts.mkBool false ''
Disable filename header for the preview page.
'';
toc = helpers.defaultNullOpts.mkListOf types.str "[]" ''
Toc options.
'';
};
}
)
"Preview options";
markdown_css = helpers.defaultNullOpts.mkStr "" ''
Custom markdown style.
Must be an absolute path like `"/Users/username/markdown.css"` or
`{__raw = "vim.fn.expand('~/markdown.css')";}`.
'';
highlight_css = helpers.defaultNullOpts.mkStr "" ''
Custom highlight style.
Must be an absolute path like "/Users/username/highlight.css" or
`{__raw = "vim.fn.expand('~/highlight.css')";}`.
'';
port = helpers.defaultNullOpts.mkStr "" ''
Custom port to start server or empty for random.
'';
page_title = helpers.defaultNullOpts.mkStr "\$\{name}" ''
Preview page title.
`$${name}` will be replaced with the file name.
'';
images_path = helpers.defaultNullOpts.mkStr "" ''
Use a custom location for images.
'';
filetypes = helpers.defaultNullOpts.mkListOf types.str ''["markdown"]'' ''
Recognized filetypes. These filetypes will have `MarkdownPreview...` commands.
'';
theme = helpers.mkNullOrOption (types.enum ["dark" "light"]) ''
Default theme (dark or light).
By default the theme is define according to the preferences of the system.
'';
combine_preview = helpers.defaultNullOpts.mkBool false ''
Combine preview window.
If enable it will reuse previous opened preview window when you preview markdown file.
Ensure to set `auto_close = false` if you have enable this option.
'';
combine_preview_auto_refresh = helpers.defaultNullOpts.mkBool true ''
Auto refetch combine preview contents when change markdown buffer only when
`combine_preview` is `true`.
'';
};
settingsExample = {
auto_start = true;
auto_close = true;
browser = "firefox";
echo_preview_url = true;
preview_options = {
disable_sync_scroll = true;
sync_scroll_type = "middle";
disable_filename = true;
toc = helpers.defaultNullOpts.mkListOf types.str "[]" ''
Toc options.
'';
};
markdown_css = "/Users/username/markdown.css";
highlight_css.__raw = "vim.fn.expand('~/highlight.css')";
port = "8080";
page_title = "\$\{name}";
theme = "dark";
}) "Preview options";
markdown_css = helpers.defaultNullOpts.mkStr "" ''
Custom markdown style.
Must be an absolute path like `"/Users/username/markdown.css"` or
`{__raw = "vim.fn.expand('~/markdown.css')";}`.
'';
highlight_css = helpers.defaultNullOpts.mkStr "" ''
Custom highlight style.
Must be an absolute path like "/Users/username/highlight.css" or
`{__raw = "vim.fn.expand('~/highlight.css')";}`.
'';
port = helpers.defaultNullOpts.mkStr "" ''
Custom port to start server or empty for random.
'';
page_title = helpers.defaultNullOpts.mkStr "\$\{name}" ''
Preview page title.
`$${name}` will be replaced with the file name.
'';
images_path = helpers.defaultNullOpts.mkStr "" ''
Use a custom location for images.
'';
filetypes = helpers.defaultNullOpts.mkListOf types.str ''["markdown"]'' ''
Recognized filetypes. These filetypes will have `MarkdownPreview...` commands.
'';
theme =
helpers.mkNullOrOption
(types.enum [
"dark"
"light"
])
''
Default theme (dark or light).
By default the theme is define according to the preferences of the system.
'';
combine_preview = helpers.defaultNullOpts.mkBool false ''
Combine preview window.
If enable it will reuse previous opened preview window when you preview markdown file.
Ensure to set `auto_close = false` if you have enable this option.
'';
combine_preview_auto_refresh = helpers.defaultNullOpts.mkBool true ''
Auto refetch combine preview contents when change markdown buffer only when
`combine_preview` is `true`.
'';
};
settingsExample = {
auto_start = true;
auto_close = true;
browser = "firefox";
echo_preview_url = true;
preview_options = {
disable_sync_scroll = true;
sync_scroll_type = "middle";
disable_filename = true;
};
}
markdown_css = "/Users/username/markdown.css";
highlight_css.__raw = "vim.fn.expand('~/highlight.css')";
port = "8080";
page_title = "\$\{name}";
theme = "dark";
};
}

View file

@ -10,5 +10,5 @@ helpers.vim-plugin.mkVimPlugin config {
originalName = "vim-nix";
defaultPackage = pkgs.vimPlugins.vim-nix;
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
}

View file

@ -5,128 +5,124 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.nvim-jdtls;
in {
options.plugins.nvim-jdtls =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "nvim-jdtls";
in
{
options.plugins.nvim-jdtls = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-jdtls";
package = helpers.mkPackageOption "nvim-jdtls" pkgs.vimPlugins.nvim-jdtls;
package = helpers.mkPackageOption "nvim-jdtls" pkgs.vimPlugins.nvim-jdtls;
cmd = helpers.mkNullOrOption (types.listOf types.str) ''
The command that starts the language server.
cmd = helpers.mkNullOrOption (types.listOf types.str) ''
The command that starts the language server.
You should either set a value for this option, or, you can instead set the `data` (and
`configuration`) options.
You should either set a value for this option, or, you can instead set the `data` (and
`configuration`) options.
```nix
plugins.nvim-jdtls = {
enable = true;
cmd = [
(lib.getExe pkgs.jdt-language-server)
"-data" "/path/to/your/workspace"
"-configuration" "/path/to/your/configuration"
"-foo" "bar"
];
};
```
```nix
plugins.nvim-jdtls = {
enable = true;
cmd = [
(lib.getExe pkgs.jdt-language-server)
"-data" "/path/to/your/workspace"
"-configuration" "/path/to/your/configuration"
"-foo" "bar"
];
};
```
Or,
```nix
plugins.nvim-jdtls = {
enable = true;
data = "/path/to/your/workspace";
configuration = "/path/to/your/configuration";
};
```
Or,
```nix
plugins.nvim-jdtls = {
enable = true;
data = "/path/to/your/workspace";
configuration = "/path/to/your/configuration";
};
```
'';
data = mkOption {
type = types.nullOr types.str;
default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/workspace";
description = ''
eclipse.jdt.ls stores project specific data within the folder set via the -data flag.
If you're using eclipse.jdt.ls with multiple different projects you must use a dedicated
data directory per project.
'';
};
data = mkOption {
type = types.nullOr types.str;
default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/workspace";
description = ''
eclipse.jdt.ls stores project specific data within the folder set via the -data flag.
If you're using eclipse.jdt.ls with multiple different projects you must use a dedicated
data directory per project.
'';
};
configuration = mkOption {
type = types.nullOr types.str;
default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/config";
description = "Path to the configuration file.";
};
configuration = mkOption {
type = types.nullOr types.str;
default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/config";
description = "Path to the configuration file.";
};
rootDir =
helpers.defaultNullOpts.mkNullable
(types.either types.str helpers.nixvimTypes.rawLua)
rootDir =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
''{ __raw = "require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})"; }''
''
This is the default if not provided, you can remove it. Or adjust as needed.
One dedicated LSP server & client will be started per unique root_dir
'';
settings =
helpers.mkNullOrOption types.attrs
''
Here you can configure eclipse.jdt.ls specific settings
See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
for a list of options.
'';
settings = helpers.mkNullOrOption types.attrs ''
Here you can configure eclipse.jdt.ls specific settings
See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
for a list of options.
'';
initOptions =
helpers.mkNullOrOption types.attrs
''
Language server `initializationOptions`
You need to extend the `bundles` with paths to jar files if you want to use additional
eclipse.jdt.ls plugins.
initOptions = helpers.mkNullOrOption types.attrs ''
Language server `initializationOptions`
You need to extend the `bundles` with paths to jar files if you want to use additional
eclipse.jdt.ls plugins.
See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
If you don't plan on using the debugger or other eclipse.jdt.ls plugins, ignore this option
'';
};
If you don't plan on using the debugger or other eclipse.jdt.ls plugins, ignore this option
'';
};
config = let
cmd =
if (cfg.cmd == null)
then let
data =
if (cfg.data == null)
then
throw ''
You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd'
option.
''
else cfg.data;
in
[
(lib.getExe pkgs.jdt-language-server)
]
++ ["-data" data]
++ (
optionals (cfg.configuration != null)
["-configuration" cfg.configuration]
)
else cfg.cmd;
config =
let
cmd =
if (cfg.cmd == null) then
let
data =
if (cfg.data == null) then
throw ''
You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd'
option.
''
else
cfg.data;
in
[ (lib.getExe pkgs.jdt-language-server) ]
++ [
"-data"
data
]
++ (optionals (cfg.configuration != null) [
"-configuration"
cfg.configuration
])
else
cfg.cmd;
options =
{
options = {
inherit cmd;
root_dir = cfg.rootDir;
inherit (cfg) settings;
init_options = cfg.initOptions;
}
// cfg.extraOptions;
in
} // cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraPackages = [pkgs.jdt-language-server];
extraPackages = [ pkgs.jdt-language-server ];
autoCmd = [
{

View file

@ -5,17 +5,20 @@
pkgs,
...
}:
with lib; let
with lib;
let
defaultFuzzyFinder = "skim";
in {
in
{
options.plugins.openscad = {
enable = mkEnableOption "openscad.nvim, a plugin to manage OpenSCAD files";
package = helpers.mkPackageOption "openscad.nvim" pkgs.vimPlugins.openscad-nvim;
fuzzyFinder =
helpers.defaultNullOpts.mkEnum ["skim" "fzf"] defaultFuzzyFinder
"fuzzy finder to find documentation";
fuzzyFinder = helpers.defaultNullOpts.mkEnum [
"skim"
"fzf"
] defaultFuzzyFinder "fuzzy finder to find documentation";
cheatsheetWindowBlend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "15" "";
@ -30,28 +33,23 @@ in {
helpTrigger = helpers.defaultNullOpts.mkStr "<A-h>" "Fuzzy find help resource";
helpManualTrigger =
helpers.defaultNullOpts.mkStr "<A-m>"
"Open offline openscad manual in pdf via zathura";
helpManualTrigger = helpers.defaultNullOpts.mkStr "<A-m>" "Open offline openscad manual in pdf via zathura";
execOpenSCADTrigger = helpers.defaultNullOpts.mkStr "<A-o>" "Open file in OpenSCAD";
topToggle =
helpers.defaultNullOpts.mkStr "<A-c>"
"toggle htop filtered for openscad processes";
topToggle = helpers.defaultNullOpts.mkStr "<A-c>" "toggle htop filtered for openscad processes";
};
};
config = let
cfg = config.plugins.openscad;
fuzzyFinder =
if (cfg.fuzzyFinder == null)
then defaultFuzzyFinder
else cfg.fuzzyFinder;
in
config =
let
cfg = config.plugins.openscad;
fuzzyFinder = if (cfg.fuzzyFinder == null) then defaultFuzzyFinder else cfg.fuzzyFinder;
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins;
[cfg.package]
extraPlugins =
with pkgs.vimPlugins;
[ cfg.package ]
++ (optional (fuzzyFinder == "skim") skim-vim)
++ (optional (fuzzyFinder == "fzf") fzf-vim);

View file

@ -10,12 +10,19 @@ helpers.vim-plugin.mkVimPlugin config {
defaultPackage = pkgs.vimPlugins.parinfer-rust;
globalPrefix = "parinfer_";
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
settingsOptions = {
mode = helpers.defaultNullOpts.mkEnumFirstDefault ["smart" "indent" "paren"] ''
The mode used to process buffer changes.
'';
mode =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"smart"
"indent"
"paren"
]
''
The mode used to process buffer changes.
'';
force_balance = helpers.defaultNullOpts.mkBool false ''
In smart mode and indent mode, parinfer will sometimes leave unbalanced brackets around the

View file

@ -5,7 +5,8 @@
pkgs,
...
}:
with lib; {
with lib;
{
options.plugins.plantuml-syntax = {
enable = mkEnableOption "plantuml syntax support";
@ -23,11 +24,12 @@ with lib; {
};
};
config = let
cfg = config.plugins.plantuml-syntax;
in
config =
let
cfg = config.plugins.plantuml-syntax;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals = {
plantuml_set_makeprg = cfg.setMakeprg;

View file

@ -6,61 +6,61 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "jupytext";
originalName = "jupytext.nvim";
defaultPackage = pkgs.vimPlugins.jupytext-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "jupytext";
originalName = "jupytext.nvim";
defaultPackage = pkgs.vimPlugins.jupytext-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
settingsOptions = {
style = helpers.defaultNullOpts.mkStr "hydrogen" ''
The jupytext style to use.
'';
settingsOptions = {
style = helpers.defaultNullOpts.mkStr "hydrogen" ''
The jupytext style to use.
'';
output_extension = helpers.defaultNullOpts.mkStr "auto" ''
By default, the extension of the plain text file is automatically selected by jupytext.
This can be modified by changing the extension from auto to any other file extension supported
by Jupytext.
This is most useful to those using Quarto or Markdown.
Analogously, we can provide a default filetype that will be given to the new buffer by using
`force_ft`.
Again, this is only really useful to users of Quarto.
'';
output_extension = helpers.defaultNullOpts.mkStr "auto" ''
By default, the extension of the plain text file is automatically selected by jupytext.
This can be modified by changing the extension from auto to any other file extension supported
by Jupytext.
This is most useful to those using Quarto or Markdown.
Analogously, we can provide a default filetype that will be given to the new buffer by using
`force_ft`.
Again, this is only really useful to users of Quarto.
'';
force_ft = helpers.mkNullOrStr ''
Default filetype. Don't change unless you know what you are doing.
'';
force_ft = helpers.mkNullOrStr ''
Default filetype. Don't change unless you know what you are doing.
'';
custom_language_formatting = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
By default we use the auto mode of jupytext.
This will create a script with the correct extension for each language.
However, this can be overridden in a per language basis if you want to.
For this you can set this option.
custom_language_formatting = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
By default we use the auto mode of jupytext.
This will create a script with the correct extension for each language.
However, this can be overridden in a per language basis if you want to.
For this you can set this option.
For example, to convert python files to quarto markdown:
```nix
{
python = {
extension = "qmd";
style = "quarto";
force_ft = "quarto";
};
}
```
'';
};
For example, to convert python files to quarto markdown:
```nix
{
python = {
extension = "qmd";
style = "quarto";
force_ft = "quarto";
};
}
```
'';
};
settingsExample = {
style = "light";
output_extension = "auto";
force_ft = null;
custom_language_formatting = {
python = {
extension = "md";
style = "markdown";
force_ft = "markdown";
};
settingsExample = {
style = "light";
output_extension = "auto";
force_ft = null;
custom_language_formatting = {
python = {
extension = "md";
style = "markdown";
force_ft = "markdown";
};
};
}
};
}

View file

@ -6,67 +6,81 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "qmk";
originalName = "qmk.nvim";
defaultPackage = pkgs.vimPlugins.qmk-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "qmk";
originalName = "qmk.nvim";
defaultPackage = pkgs.vimPlugins.qmk-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
settingsOptions = {
name = mkOption {
type = types.str;
example = "LAYOUT_preonic_grid";
description = ''
The name of your layout, for example `LAYOUT_preonic_grid` for the preonic keyboard, for
zmk this can just be anything, it won't be used.
settingsOptions = {
name = mkOption {
type = types.str;
example = "LAYOUT_preonic_grid";
description = ''
The name of your layout, for example `LAYOUT_preonic_grid` for the preonic keyboard, for
zmk this can just be anything, it won't be used.
'';
};
layout = mkOption {
type = with types; listOf str;
example = [
"x x"
"x^x"
];
description = ''
The keyboard key layout.
The layout config describes your layout as expected by qmk_firmware.
As qmk_firmware is simply expecting an array of key codes, the layout is pretty much up to
you.
A layout is a list of strings, where each string in the list represents a single row.
Rows must all be the same width, and you'll see they visually align to what your keymap
looks like.
'';
};
variant =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"qmk"
"zmk"
]
''
Chooses the expected hardware target.
'';
};
layout = mkOption {
type = with types; listOf str;
example = [
"x x"
"x^x"
];
description = ''
The keyboard key layout.
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 ''
Duration of `vim.notify` timeout if using `nvim-notify`.
'';
The layout config describes your layout as expected by qmk_firmware.
As qmk_firmware is simply expecting an array of key codes, the layout is pretty much up to
you.
auto_format_pattern = helpers.defaultNullOpts.mkStr "*keymap.c" ''
The autocommand file pattern to use when applying `QMKFormat` on save.
'';
A layout is a list of strings, where each string in the list represents a single row.
Rows must all be the same width, and you'll see they visually align to what your keymap
looks like.
'';
};
comment_preview = {
position =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"top"
"bottom"
"inside"
"none"
]
''
Control the position of the preview, set to `none` to disable (`inside` is only valid for
`variant=qmk`).
'';
variant = helpers.defaultNullOpts.mkEnumFirstDefault ["qmk" "zmk"] ''
Chooses the expected hardware target.
keymap_overrides = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
A dictionary of key codes to text replacements, any provided value will be merged with the
existing dictionary, see [key_map.lua](https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua) for details.
'';
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 ''
Duration of `vim.notify` timeout if using `nvim-notify`.
'';
auto_format_pattern = helpers.defaultNullOpts.mkStr "*keymap.c" ''
The autocommand file pattern to use when applying `QMKFormat` on save.
'';
comment_preview = {
position = helpers.defaultNullOpts.mkEnumFirstDefault ["top" "bottom" "inside" "none"] ''
Control the position of the preview, set to `none` to disable (`inside` is only valid for
`variant=qmk`).
'';
keymap_overrides = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
A dictionary of key codes to text replacements, any provided value will be merged with the
existing dictionary, see [key_map.lua](https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua) for details.
'';
symbols =
helpers.defaultNullOpts.mkAttrsOf types.str
symbols =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
space = " ";
@ -86,35 +100,35 @@ with lib;
''
A dictionary of symbols used for the preview comment border chars see [default.lua](https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/default.lua) for details.
'';
};
};
};
settingsExample = {
name = "LAYOUT_preonic_grid";
layout = [
"x x"
"x^x"
];
variant = "qmk";
timeout = 5000;
auto_format_pattern = "*keymap.c";
comment_preview = {
position = "top";
keymap_overrides = {};
symbols = {
space = " ";
horz = "";
vert = "";
tl = "";
tm = "";
tr = "";
ml = "";
mm = "";
mr = "";
bl = "";
bm = "";
br = "";
};
settingsExample = {
name = "LAYOUT_preonic_grid";
layout = [
"x x"
"x^x"
];
variant = "qmk";
timeout = 5000;
auto_format_pattern = "*keymap.c";
comment_preview = {
position = "top";
keymap_overrides = { };
symbols = {
space = " ";
horz = "";
vert = "";
tl = "";
tm = "";
tr = "";
ml = "";
mm = "";
mr = "";
bl = "";
bm = "";
br = "";
};
};
}
};
}

View file

@ -5,143 +5,123 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.rust-tools;
in {
options.plugins.rust-tools =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "rust tools plugins";
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
serverPackage = mkOption {
type = with types; nullOr package;
default = pkgs.rust-analyzer;
description = "Package to use for rust-analyzer. rust-analyzer will not be installed if this is set to `null`";
};
in
{
options.plugins.rust-tools = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "rust tools plugins";
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
serverPackage = mkOption {
type = with types; nullOr package;
default = pkgs.rust-analyzer;
description = "Package to use for rust-analyzer. rust-analyzer will not be installed if this is set to `null`";
};
executor =
helpers.defaultNullOpts.mkEnumFirstDefault ["termopen" "quickfix"]
"how to execute terminal commands";
executor = helpers.defaultNullOpts.mkEnumFirstDefault [
"termopen"
"quickfix"
] "how to execute terminal commands";
onInitialized =
helpers.defaultNullOpts.mkLuaFn "null"
''
Callback to execute once rust-analyzer is done initializing the workspace
The callback receives one parameter indicating the `health` of the server:
"ok" | "warning" | "error"
'';
onInitialized = helpers.defaultNullOpts.mkLuaFn "null" ''
Callback to execute once rust-analyzer is done initializing the workspace
The callback receives one parameter indicating the `health` of the server:
"ok" | "warning" | "error"
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
'';
inlayHints = {
auto = helpers.defaultNullOpts.mkBool true "automatically set inlay hints (type hints)";
inlayHints = {
auto = helpers.defaultNullOpts.mkBool true "automatically set inlay hints (type hints)";
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show for current line";
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show for current line";
showParameterHints =
helpers.defaultNullOpts.mkBool true
"whether to show parameter hints with the inlay hints or not";
showParameterHints = helpers.defaultNullOpts.mkBool true "whether to show parameter hints with the inlay hints or not";
parameterHintsPrefix =
helpers.defaultNullOpts.mkStr "<- "
"prefix for parameter hints";
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "prefix for parameter hints";
otherHintsPrefix =
helpers.defaultNullOpts.mkStr "=> "
"prefix for all the other hints (type, chaining)";
otherHintsPrefix = helpers.defaultNullOpts.mkStr "=> " "prefix for all the other hints (type, chaining)";
maxLenAlign =
helpers.defaultNullOpts.mkBool false
"whether to align to the length of the longest line in the file";
maxLenAlign = helpers.defaultNullOpts.mkBool false "whether to align to the length of the longest line in the file";
maxLenAlignPadding =
helpers.defaultNullOpts.mkInt 1
maxLenAlignPadding =
helpers.defaultNullOpts.mkInt 1
"padding from the left if max_len_align is true";
rightAlign =
helpers.defaultNullOpts.mkBool false
"whether to align to the extreme right or not";
rightAlign = helpers.defaultNullOpts.mkBool false "whether to align to the extreme right or not";
rightAlignPadding =
helpers.defaultNullOpts.mkInt 7
"padding from the right if right_align is true";
rightAlignPadding = helpers.defaultNullOpts.mkInt 7 "padding from the right if right_align is true";
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints";
};
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints";
};
hoverActions = {
border =
helpers.defaultNullOpts.mkBorder ''
[
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
]
''
"rust-tools hover window" "";
hoverActions = {
border = helpers.defaultNullOpts.mkBorder ''
[
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
[ "" "FloatBorder" ]
]
'' "rust-tools hover window" "";
maxWidth =
helpers.defaultNullOpts.mkNullable types.int "null"
maxWidth =
helpers.defaultNullOpts.mkNullable types.int "null"
"Maximal width of the hover window. null means no max.";
maxHeight =
helpers.defaultNullOpts.mkNullable types.int "null"
maxHeight =
helpers.defaultNullOpts.mkNullable types.int "null"
"Maximal height of the hover window. null means no max.";
autoFocus =
helpers.defaultNullOpts.mkBool false
"whether the hover action window gets automatically focused";
};
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph
see: https://graphviz.org/docs/outputs/
'';
output =
helpers.defaultNullOpts.mkStr "null"
"where to store the output, nil for no output stored";
full = helpers.defaultNullOpts.mkBool true ''
true for all crates.io and external crates, false only the local crates
'';
enabledGraphvizBackends =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) "null"
''
List of backends found on: https://graphviz.org/docs/outputs/
Is used for input validation and autocompletion
'';
};
server =
{
standalone = helpers.defaultNullOpts.mkBool true ''
standalone file support
setting it to false may improve startup time
'';
}
// (import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs);
autoFocus = helpers.defaultNullOpts.mkBool false "whether the hover action window gets automatically focused";
};
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
extraPackages = [cfg.serverPackage];
plugins.lsp.postConfig = let
options =
{
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph
see: https://graphviz.org/docs/outputs/
'';
output = helpers.defaultNullOpts.mkStr "null" "where to store the output, nil for no output stored";
full = helpers.defaultNullOpts.mkBool true ''
true for all crates.io and external crates, false only the local crates
'';
enabledGraphvizBackends = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "null" ''
List of backends found on: https://graphviz.org/docs/outputs/
Is used for input validation and autocompletion
'';
};
server = {
standalone = helpers.defaultNullOpts.mkBool true ''
standalone file support
setting it to false may improve startup time
'';
} // (import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs);
};
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
nvim-lspconfig
cfg.package
];
extraPackages = [ cfg.serverPackage ];
plugins.lsp.postConfig =
let
options = {
tools = {
executor =
helpers.ifNonNull' cfg.executor
(helpers.mkRaw "require(${rust-tools.executors}).${cfg.executor}");
executor = helpers.ifNonNull' cfg.executor (
helpers.mkRaw "require(${rust-tools.executors}).${cfg.executor}"
);
on_initialized = cfg.onInitialized;
@ -176,10 +156,10 @@ in {
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
on_attach = helpers.mkRaw "__lspOnAttach";
};
}
// cfg.extraOptions;
in ''
require('rust-tools').setup(${helpers.toLuaObject options})
'';
} // cfg.extraOptions;
in
''
require('rust-tools').setup(${helpers.toLuaObject options})
'';
};
}

View file

@ -5,94 +5,90 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.rustaceanvim;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.rustaceanvim =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "rustaceanvim";
options.plugins.rustaceanvim = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "rustaceanvim";
package = helpers.mkPackageOption "rustaceanvim" pkgs.vimPlugins.rustaceanvim;
package = helpers.mkPackageOption "rustaceanvim" pkgs.vimPlugins.rustaceanvim;
rustAnalyzerPackage = mkOption {
type = with types; nullOr package;
default = pkgs.rust-analyzer;
description = ''
Which package to use for `rust-analyzer`.
Set to `null` to disable its automatic installation.
rustAnalyzerPackage = mkOption {
type = with types; nullOr package;
default = pkgs.rust-analyzer;
description = ''
Which package to use for `rust-analyzer`.
Set to `null` to disable its automatic installation.
'';
example = null;
};
tools = {
executor = helpers.defaultNullOpts.mkNullable (
with helpers.nixvimTypes;
either strLuaFn (enum [
"termopen"
"quickfix"
"toggleterm"
"vimux"
])
) "termopen" "How to execute terminal commands.";
onInitialized = helpers.mkNullOrLuaFn ''
`fun(health:RustAnalyzerInitializedStatus)`
Function that is invoked when the LSP server has finished initializing.
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
'';
hoverActions = {
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true ''
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
'';
example = null;
};
tools = {
executor =
helpers.defaultNullOpts.mkNullable
(
with helpers.nixvimTypes;
either
strLuaFn
(enum ["termopen" "quickfix" "toggleterm" "vimux"])
)
"termopen"
"How to execute terminal commands.";
floatWinConfig = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
border = [
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
];
max_width = null;
max_height = null;
auto_focus = false;
}
'' "Options applied to floating windows. See |api-win_config|.";
onInitialized = helpers.mkNullOrLuaFn ''
`fun(health:RustAnalyzerInitializedStatus)`
Function that is invoked when the LSP server has finished initializing.
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph.
See: https://graphviz.org/docs/outputs
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
output = helpers.mkNullOrStr ''
Where to store the output.
No output if unset.
Relative path from `cwd`.
'';
hoverActions = {
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true ''
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
'';
};
full = helpers.defaultNullOpts.mkBool true ''
`true` for all crates.io and external crates, false only the local crates.
'';
floatWinConfig =
helpers.defaultNullOpts.mkAttrsOf types.anything
''
{
border = [
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
];
max_width = null;
max_height = null;
auto_focus = false;
}
''
"Options applied to floating windows. See |api-win_config|.";
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph.
See: https://graphviz.org/docs/outputs
'';
output = helpers.mkNullOrStr ''
Where to store the output.
No output if unset.
Relative path from `cwd`.
'';
full = helpers.defaultNullOpts.mkBool true ''
`true` for all crates.io and external crates, false only the local crates.
'';
enabledGraphvizBackends =
helpers.defaultNullOpts.mkListOf types.str
enabledGraphvizBackends =
helpers.defaultNullOpts.mkListOf types.str
''
[
"bmp" "cgimage" "canon" "dot" "gv" "xdot" "xdot1.2" "xdot1.4" "eps" "exr" "fig" "gd"
@ -106,55 +102,53 @@ in {
Override the enabled graphviz backends list, used for input validation and autocompletion.
'';
pipe = helpers.mkNullOrStr ''
Override the pipe symbol in the shell command.
Useful if using a shell that is not supported by this plugin.
'';
};
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
If set, overrides how to open URLs.
pipe = helpers.mkNullOrStr ''
Override the pipe symbol in the shell command.
Useful if using a shell that is not supported by this plugin.
'';
};
server = {
autoAttach = helpers.mkNullOrStrLuaFnOr types.bool ''
Whether to automatically attach the LSP client.
Defaults to `true` if the `rust-analyzer` executable is found.
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
If set, overrides how to open URLs.
'';
};
This can also be the definition of a function (`fun():boolean`).
server = {
autoAttach = helpers.mkNullOrStrLuaFnOr types.bool ''
Whether to automatically attach the LSP client.
Defaults to `true` if the `rust-analyzer` executable is found.
Default:
```lua
function()
local cmd = types.evaluate(RustaceanConfig.server.cmd)
---@cast cmd string[]
local rs_bin = cmd[1]
return vim.fn.executable(rs_bin) == 1
end
```
'';
This can also be the definition of a function (`fun():boolean`).
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Function to call on attach";
Default:
```lua
function()
local cmd = types.evaluate(RustaceanConfig.server.cmd)
---@cast cmd string[]
local rs_bin = cmd[1]
return vim.fn.executable(rs_bin) == 1
end
```
'';
cmd = helpers.mkNullOrStrLuaFnOr (with types; listOf str) ''
Command and arguments for starting rust-analyzer.
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Function to call on attach";
This can also be the definition of a function (`fun():string[]`).
cmd = helpers.mkNullOrStrLuaFnOr (with types; listOf str) ''
Command and arguments for starting rust-analyzer.
Default:
```lua
function()
return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile }
end
```
'';
This can also be the definition of a function (`fun():string[]`).
settings =
helpers.mkNullOrStrLuaFnOr (types.submodule {
options =
import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs;
})
Default:
```lua
function()
return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile }
end
```
'';
settings =
helpers.mkNullOrStrLuaFnOr
(types.submodule { options = import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs; })
''
Setting passed to rust-analyzer.
Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table.
@ -170,29 +164,33 @@ in {
```
'';
standalone = helpers.defaultNullOpts.mkBool true ''
Standalone file support (enabled by default).
Disabling it may improve rust-analyzer's startup time.
'';
standalone = helpers.defaultNullOpts.mkBool true ''
Standalone file support (enabled by default).
Disabling it may improve rust-analyzer's startup time.
'';
logfile =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either str rawLua)
logfile =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either str rawLua)
''{__raw = "vim.fn.tempname() .. '-rust-analyzer.log'";}''
"The path to the rust-analyzer log file.";
};
};
dap = {
autoloadConfigurations = helpers.defaultNullOpts.mkBool true ''
Whether to autoload nvim-dap configurations when rust-analyzer has attached ?
'';
dap = {
autoloadConfigurations = helpers.defaultNullOpts.mkBool true ''
Whether to autoload nvim-dap configurations when rust-analyzer has attached ?
'';
adapter = let
adapter =
let
dapConfig = types.submodule {
freeformType = with types; attrsOf anything;
options = {
# Common options
type = mkOption {
type = types.enum ["executable" "server"];
type = types.enum [
"executable"
"server"
];
description = "The type for the debug adapter.";
};
@ -220,67 +218,58 @@ in {
};
};
in
helpers.mkNullOrStrLuaFnOr
(
with types;
either
(enum [false])
dapConfig
)
''
Defaults to creating the `rt_lldb` adapter, which is a `DapServerConfig` if `codelldb`
is detected, and a `DapExecutableConfig` if `lldb` is detected.
Set to `false` to disable.
'';
};
helpers.mkNullOrStrLuaFnOr (with types; either (enum [ false ]) dapConfig) ''
Defaults to creating the `rt_lldb` adapter, which is a `DapServerConfig` if `codelldb`
is detected, and a `DapExecutableConfig` if `lldb` is detected.
Set to `false` to disable.
'';
};
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraPackages = [cfg.rustAnalyzerPackage];
extraPackages = [ cfg.rustAnalyzerPackage ];
plugins.lsp.postConfig = let
globalOptions = with cfg;
{
tools = with tools; {
inherit executor;
on_initialized = onInitialized;
reload_workspace_from_cargo_toml = reloadWorkspaceFromCargoToml;
hover_actions = {
replace_builtin_hover = hoverActions.replaceBuiltinHover;
plugins.lsp.postConfig =
let
globalOptions =
with cfg;
{
tools = with tools; {
inherit executor;
on_initialized = onInitialized;
reload_workspace_from_cargo_toml = reloadWorkspaceFromCargoToml;
hover_actions = {
replace_builtin_hover = hoverActions.replaceBuiltinHover;
};
float_win_config = floatWinConfig;
create_graph = {
inherit (crateGraph) backend output full;
enabled_graphviz_backends = crateGraph.enabledGraphvizBackends;
inherit (crateGraph) pipe;
};
open_url = openUrl;
};
float_win_config = floatWinConfig;
create_graph = {
server = with server; {
auto_attach = autoAttach;
on_attach = onAttach;
inherit
(crateGraph)
backend
output
full
cmd
settings
standalone
logfile
;
enabled_graphviz_backends = crateGraph.enabledGraphvizBackends;
inherit (crateGraph) pipe;
};
open_url = openUrl;
};
server = with server; {
auto_attach = autoAttach;
on_attach = onAttach;
inherit
cmd
settings
standalone
logfile
;
};
dap = with dap; {
autoload_configurations = autoloadConfigurations;
inherit adapter;
};
}
// cfg.extraOptions;
in ''
vim.g.rustaceanvim = ${helpers.toLuaObject globalOptions}
'';
dap = with dap; {
autoload_configurations = autoloadConfigurations;
inherit adapter;
};
}
// cfg.extraOptions;
in
''
vim.g.rustaceanvim = ${helpers.toLuaObject globalOptions}
'';
};
}

View file

@ -5,134 +5,117 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.sniprun;
mkList = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in {
options.plugins.sniprun =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "sniprun";
in
{
options.plugins.sniprun = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "sniprun";
package = helpers.mkPackageOption "sniprun" pkgs.vimPlugins.sniprun;
package = helpers.mkPackageOption "sniprun" pkgs.vimPlugins.sniprun;
selectedInterpreters =
mkList "[]"
"use those instead of the default for the current filetype";
selectedInterpreters = mkList "[]" "use those instead of the default for the current filetype";
replEnable = mkList "[]" "Enable REPL-like behavior for the given interpreters";
replEnable = mkList "[]" "Enable REPL-like behavior for the given interpreters";
replDisable = mkList "[]" "Disable REPL-like behavior for the given interpreters";
replDisable = mkList "[]" "Disable REPL-like behavior for the given interpreters";
interpreterOptions =
helpers.defaultNullOpts.mkNullable types.attrs "{}"
interpreterOptions =
helpers.defaultNullOpts.mkNullable types.attrs "{}"
"interpreter-specific options, see docs / :SnipInfo <name>";
display =
mkList ''["Classic" "VirtualTextOk"]''
''
You can combo different display modes as desired and with the 'Ok' or 'Err' suffix to filter
only successful runs (or errored-out runs respectively)
display = mkList ''["Classic" "VirtualTextOk"]'' ''
You can combo different display modes as desired and with the 'Ok' or 'Err' suffix to filter
only successful runs (or errored-out runs respectively)
Example:
```nix
[
"Classic" # display results in the command-line area
"VirtualTextOk" # display ok results as virtual text (multiline is shortened)
Example:
```nix
[
"Classic" # display results in the command-line area
"VirtualTextOk" # display ok results as virtual text (multiline is shortened)
# "VirtualText" # display results as virtual text
# "TempFloatingWindow" # display results in a floating window
# "LongTempFloatingWindow" # same as above, but only long results. To use with VirtualText[Ok/Err]
# "Terminal" # display results in a vertical split
# "TerminalWithCode" # display results and code history in a vertical split
# "NvimNotify" # display with the nvim-notify plugin
# "Api" # return output to a programming interface
]
```
'';
# "VirtualText" # display results as virtual text
# "TempFloatingWindow" # display results in a floating window
# "LongTempFloatingWindow" # same as above, but only long results. To use with VirtualText[Ok/Err]
# "Terminal" # display results in a vertical split
# "TerminalWithCode" # display results and code history in a vertical split
# "NvimNotify" # display with the nvim-notify plugin
# "Api" # return output to a programming interface
]
```
'';
liveDisplay =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["VirtualTextOk"]''
liveDisplay =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["VirtualTextOk"]''
"Display modes used in live_mode";
displayOptions = {
terminalWidth =
helpers.defaultNullOpts.mkInt 45
"Change the terminal display option width.";
displayOptions = {
terminalWidth = helpers.defaultNullOpts.mkInt 45 "Change the terminal display option width.";
notificationTimeout =
helpers.defaultNullOpts.mkInt 5
"Timeout for nvim_notify output.";
};
showNoOutput = mkList ''["Classic" "TempFloatingWindow"]'' ''
You can use the same keys to customize whether a sniprun producing no output should display
nothing or '(no output)'.
'';
snipruncolors = let
colorOption = {
fg ? "",
bg ? "",
ctermbg ? "",
ctermfg ? "",
}: {
bg = helpers.defaultNullOpts.mkStr fg "Background color";
fg = helpers.defaultNullOpts.mkStr bg "Foreground color";
ctermbg = helpers.defaultNullOpts.mkStr ctermbg "Foreground color";
ctermfg = helpers.defaultNullOpts.mkStr ctermfg "Foreground color";
};
in
mapAttrs
(optionName: colorOption)
{
SniprunVirtualTextOk = {
bg = "#66eeff";
fg = "#000000";
ctermbg = "Cyan";
ctermfg = "Black";
};
SniprunFloatingWinOk = {
fg = "#66eeff";
ctermfg = "Cyan";
};
SniprunVirtualTextErr = {
bg = "#881515";
fg = "#000000";
ctermbg = "DarkRed";
ctermfg = "Black";
};
SniprunFloatingWinErr = {
fg = "#881515";
ctermfg = "DarkRed";
};
};
liveModeToggle =
helpers.defaultNullOpts.mkStr "off"
"Live mode toggle, see Usage - Running for more info.";
borders = helpers.defaultNullOpts.mkBorder "single" "floating windows" "";
notificationTimeout = helpers.defaultNullOpts.mkInt 5 "Timeout for nvim_notify output.";
};
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins;
[
cfg.package
]
++ (
optional
(
(cfg.display != null)
&& (any (hasPrefix "NvimNotify") cfg.display)
)
nvim-notify
);
showNoOutput = mkList ''["Classic" "TempFloatingWindow"]'' ''
You can use the same keys to customize whether a sniprun producing no output should display
nothing or '(no output)'.
'';
extraConfigLua = let
options =
{
snipruncolors =
let
colorOption =
{
fg ? "",
bg ? "",
ctermbg ? "",
ctermfg ? "",
}:
{
bg = helpers.defaultNullOpts.mkStr fg "Background color";
fg = helpers.defaultNullOpts.mkStr bg "Foreground color";
ctermbg = helpers.defaultNullOpts.mkStr ctermbg "Foreground color";
ctermfg = helpers.defaultNullOpts.mkStr ctermfg "Foreground color";
};
in
mapAttrs (optionName: colorOption) {
SniprunVirtualTextOk = {
bg = "#66eeff";
fg = "#000000";
ctermbg = "Cyan";
ctermfg = "Black";
};
SniprunFloatingWinOk = {
fg = "#66eeff";
ctermfg = "Cyan";
};
SniprunVirtualTextErr = {
bg = "#881515";
fg = "#000000";
ctermbg = "DarkRed";
ctermfg = "Black";
};
SniprunFloatingWinErr = {
fg = "#881515";
ctermfg = "DarkRed";
};
};
liveModeToggle = helpers.defaultNullOpts.mkStr "off" "Live mode toggle, see Usage - Running for more info.";
borders = helpers.defaultNullOpts.mkBorder "single" "floating windows" "";
};
config = mkIf cfg.enable {
extraPlugins =
with pkgs.vimPlugins;
[ cfg.package ]
++ (optional ((cfg.display != null) && (any (hasPrefix "NvimNotify") cfg.display)) nvim-notify);
extraConfigLua =
let
options = {
selected_interpreters = cfg.selectedInterpreters;
repl_enable = cfg.replEnable;
repl_disable = cfg.replDisable;
@ -147,10 +130,10 @@ in {
inherit (cfg) snipruncolors;
live_mode_toggle = cfg.liveModeToggle;
inherit (cfg) borders;
}
// cfg.extraOptions;
in ''
require('sniprun').setup(${helpers.toLuaObject options})
'';
} // cfg.extraOptions;
in
''
require('sniprun').setup(${helpers.toLuaObject options})
'';
};
}

View file

@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
name = "tagbar";
defaultPackage = pkgs.vimPlugins.tagbar;
globalPrefix = "tagbar_";
extraPackages = [pkgs.ctags];
extraPackages = [ pkgs.ctags ];
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
# TODO introduced 2024-02-12: remove 2024-04-12
deprecateExtraConfig = true;
@ -22,7 +22,10 @@ helpers.vim-plugin.mkVimPlugin config {
autofocus = false;
foldlevel = 2;
autoshowtag = true;
iconchars = ["" ""];
iconchars = [
""
""
];
visibility_symbols = {
public = "󰡭 ";
protected = "󱗤 ";

View file

@ -8,26 +8,24 @@
with lib;
# This plugin has no configuration, so we use `mkVimPlugin` without the `globalPrefix` argument to
# avoid the creation of the `settings` option.
helpers.vim-plugin.mkVimPlugin config {
name = "texpresso";
originalName = "texpresso.vim";
defaultPackage = pkgs.vimPlugins.texpresso-vim;
helpers.vim-plugin.mkVimPlugin config {
name = "texpresso";
originalName = "texpresso.vim";
defaultPackage = pkgs.vimPlugins.texpresso-vim;
maintainers = [maintainers.nickhu];
maintainers = [ maintainers.nickhu ];
extraOptions = {
texpressoPackage = mkOption {
type = with types; nullOr package;
default = pkgs.texpresso;
example = null;
description = ''
The `texpresso` package to use.
Set to `null` to not install any package.
'';
};
extraOptions = {
texpressoPackage = mkOption {
type = with types; nullOr package;
default = pkgs.texpresso;
example = null;
description = ''
The `texpresso` package to use.
Set to `null` to not install any package.
'';
};
};
extraConfig = cfg: {
extraPackages = [cfg.texpressoPackage];
};
}
extraConfig = cfg: { extraPackages = [ cfg.texpressoPackage ]; };
}

View file

@ -5,10 +5,12 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.hmts;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.hmts = {
enable = mkEnableOption "hmts.nvim";
@ -21,6 +23,6 @@ in {
"Nixvim: treesitter-refactor needs treesitter to function as intended"
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
};
}

View file

@ -5,26 +5,24 @@
pkgs,
...
}:
with lib; {
options.plugins.rainbow-delimiters =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "rainbow-delimiters.nvim";
with lib;
{
options.plugins.rainbow-delimiters = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "rainbow-delimiters.nvim";
package =
helpers.mkPackageOption
"rainbow-delimiters.nvim"
pkgs.vimPlugins.rainbow-delimiters-nvim;
package = helpers.mkPackageOption "rainbow-delimiters.nvim" pkgs.vimPlugins.rainbow-delimiters-nvim;
strategy =
helpers.defaultNullOpts.mkNullable
strategy =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf (
either
helpers.nixvimTypes.rawLua
(enum ["global" "local" "noop"])
)
attrsOf (
either helpers.nixvimTypes.rawLua (enum [
"global"
"local"
"noop"
])
)
)
''
{
@ -61,9 +59,8 @@ with lib; {
```
'';
query =
helpers.defaultNullOpts.mkNullable
(with types; attrsOf str)
query =
helpers.defaultNullOpts.mkNullable (with types; attrsOf str)
''
{
default = "rainbow-delimiters";
@ -75,8 +72,8 @@ with lib; {
See `|rb-delimiters-query|` for more information about queries.
'';
highlight =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
highlight =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
''
[
"RainbowDelimiterRed"
@ -93,20 +90,19 @@ with lib; {
`|rb-delimiters-colors|`.
'';
whitelist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to enable rainbow delimiters.
Rainbow delimiters will be disabled for all other languages.
'';
whitelist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to enable rainbow delimiters.
Rainbow delimiters will be disabled for all other languages.
'';
blacklist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to disable rainbow delimiters.
Rainbow delimiters will be enabled for all other languages.
'';
blacklist = helpers.mkNullOrOption (with types; listOf str) ''
List of Tree-sitter languages for which to disable rainbow delimiters.
Rainbow delimiters will be enabled for all other languages.
'';
log = {
file =
helpers.defaultNullOpts.mkNullable
(with types; either str helpers.nixvimTypes.rawLua)
log = {
file =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''
{
__raw = "vim.fn.stdpath('log') .. '/rainbow-delimiters.log'";
@ -117,22 +113,22 @@ with lib; {
(see `|standard-path|`).
'';
level = helpers.defaultNullOpts.mkLogLevel "warn" ''
Only messages equal to or above this value will be logged.
The default is to log warnings or above.
See `|log_levels|` for possible values.
'';
};
level = helpers.defaultNullOpts.mkLogLevel "warn" ''
Only messages equal to or above this value will be logged.
The default is to log warnings or above.
See `|log_levels|` for possible values.
'';
};
};
config = let
cfg = config.plugins.rainbow-delimiters;
in
config =
let
cfg = config.plugins.rainbow-delimiters;
in
mkIf cfg.enable {
warnings =
optional
(!config.plugins.treesitter.enable)
"Nixvim: treesitter-rainbow needs treesitter to function as intended";
warnings = optional (
!config.plugins.treesitter.enable
) "Nixvim: treesitter-rainbow needs treesitter to function as intended";
assertions = [
{
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
@ -144,53 +140,27 @@ with lib; {
}
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals.rainbow_delimiters = with cfg;
globals.rainbow_delimiters =
with cfg;
{
strategy =
helpers.ifNonNull' strategy
(
mapAttrs'
(
name: value: {
name =
if name == "default"
then "__emptyString"
else name;
value =
if isString value
then helpers.mkRaw "require 'rainbow-delimiters'.strategy['${value}']"
else value;
}
)
strategy
);
query =
helpers.ifNonNull' query
(
mapAttrs'
(
name: value: {
name =
if name == "default"
then "__emptyString"
else name;
inherit value;
}
)
query
);
inherit
highlight
whitelist
blacklist
;
strategy = helpers.ifNonNull' strategy (
mapAttrs' (name: value: {
name = if name == "default" then "__emptyString" else name;
value =
if isString value then helpers.mkRaw "require 'rainbow-delimiters'.strategy['${value}']" else value;
}) strategy
);
query = helpers.ifNonNull' query (
mapAttrs' (name: value: {
name = if name == "default" then "__emptyString" else name;
inherit value;
}) query
);
inherit highlight whitelist blacklist;
log = with log; {
inherit
file
level
;
inherit file level;
};
}
// cfg.extraOptions;

View file

@ -6,88 +6,100 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "treesitter-context";
originalName = "nvim-treesitter-context";
defaultPackage = pkgs.vimPlugins.nvim-treesitter-context;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "treesitter-context";
originalName = "nvim-treesitter-context";
defaultPackage = pkgs.vimPlugins.nvim-treesitter-context;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-04-22: remove 2024-06-22
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"maxLines"
"minWindowHeight"
"lineNumbers"
"multilineThreshold"
"trimScope"
"mode"
"separator"
"zindex"
"onAttach"
# TODO introduced 2024-04-22: remove 2024-06-22
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"maxLines"
"minWindowHeight"
"lineNumbers"
"multilineThreshold"
"trimScope"
"mode"
"separator"
"zindex"
"onAttach"
];
settingsOptions = {
enable = helpers.defaultNullOpts.mkBool true ''
Enable this plugin (Can be enabled/disabled later via commands)
'';
max_lines = helpers.defaultNullOpts.mkUnsignedInt 0 ''
How many lines the window should span. 0 means no limit.
'';
min_window_height = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Minimum editor window height to enable context. 0 means no limit.
'';
line_numbers = helpers.defaultNullOpts.mkBool true ''
Whether to show line numbers.
'';
multiline_threshold = helpers.defaultNullOpts.mkUnsignedInt 20 ''
Maximum number of lines to collapse for a single context line.
'';
trim_scope =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"outer"
"inner"
]
''
Which context lines to discard if `max_lines` is exceeded.
'';
mode =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"cursor"
"topline"
]
''
Line used to calculate context.
'';
separator = helpers.mkNullOrOption types.str ''
Separator between context and content.
Should be a single character string, like "-".
When separator is set, the context will only show up when there are at least 2 lines above
cursorline.
'';
zindex = helpers.defaultNullOpts.mkUnsignedInt 20 ''
The Z-index of the context window.
'';
on_attach = helpers.defaultNullOpts.mkLuaFn "nil" ''
The implementation of a lua function which takes an integer `buf` as parameter and returns a
boolean.
Return `false` to disable attaching.
'';
};
settingsExample = {
max_lines = 0;
min_window_height = 0;
line_numbers = true;
multiline_threshold = 20;
trim_scope = "inner";
mode = "topline";
separator = "-";
zindex = 20;
};
extraConfig = cfg: {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: treesitter-context needs treesitter to function as intended"
];
settingsOptions = {
enable = helpers.defaultNullOpts.mkBool true ''
Enable this plugin (Can be enabled/disabled later via commands)
'';
max_lines = helpers.defaultNullOpts.mkUnsignedInt 0 ''
How many lines the window should span. 0 means no limit.
'';
min_window_height = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Minimum editor window height to enable context. 0 means no limit.
'';
line_numbers = helpers.defaultNullOpts.mkBool true ''
Whether to show line numbers.
'';
multiline_threshold = helpers.defaultNullOpts.mkUnsignedInt 20 ''
Maximum number of lines to collapse for a single context line.
'';
trim_scope = helpers.defaultNullOpts.mkEnumFirstDefault ["outer" "inner"] ''
Which context lines to discard if `max_lines` is exceeded.
'';
mode = helpers.defaultNullOpts.mkEnumFirstDefault ["cursor" "topline"] ''
Line used to calculate context.
'';
separator = helpers.mkNullOrOption types.str ''
Separator between context and content.
Should be a single character string, like "-".
When separator is set, the context will only show up when there are at least 2 lines above
cursorline.
'';
zindex = helpers.defaultNullOpts.mkUnsignedInt 20 ''
The Z-index of the context window.
'';
on_attach = helpers.defaultNullOpts.mkLuaFn "nil" ''
The implementation of a lua function which takes an integer `buf` as parameter and returns a
boolean.
Return `false` to disable attaching.
'';
};
settingsExample = {
max_lines = 0;
min_window_height = 0;
line_numbers = true;
multiline_threshold = 20;
trim_scope = "inner";
mode = "topline";
separator = "-";
zindex = 20;
};
extraConfig = cfg: {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: treesitter-context needs treesitter to function as intended"
];
};
}
};
}

View file

@ -1,11 +1,14 @@
{lib, ...}:
with lib; {
{ lib, ... }:
with lib;
{
# Deprecation notice added 2023/08/29
# TODO: remove (along with this file) in early November 2023.
imports = [
(
mkRemovedOptionModule
["plugins" "treesitter-playground"]
(mkRemovedOptionModule
[
"plugins"
"treesitter-playground"
]
''
The `treesitter-playground` plugin has been deprecated since the functionality is included in Neovim.
Use:

View file

@ -5,120 +5,144 @@
pkgs,
...
}:
with lib; {
options.plugins.treesitter-refactor = let
disable = mkOption {
type = types.listOf types.str;
default = [];
description = "List of languages to disable the module on";
};
in {
enable =
mkEnableOption
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
with lib;
{
options.plugins.treesitter-refactor =
let
disable = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of languages to disable the module on";
};
in
{
enable = mkEnableOption "treesitter-refactor (requires plugins.treesitter.enable to be true)";
package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor;
package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor;
highlightDefinitions = {
inherit disable;
enable =
mkEnableOption
"Highlights definition and usages of the current symbol under the cursor.";
clearOnCursorMove = mkOption {
type = types.bool;
default = true;
description = ''
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
is around `100` you can set this to false to have a less laggy experience.
highlightDefinitions = {
inherit disable;
enable = mkEnableOption "Highlights definition and usages of the current symbol under the cursor.";
clearOnCursorMove = mkOption {
type = types.bool;
default = true;
description = ''
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
is around `100` you can set this to false to have a less laggy experience.
'';
};
};
highlightCurrentScope = {
inherit disable;
enable = mkEnableOption "highlighting the block from the current scope where the cursor is";
};
smartRename = {
inherit disable;
enable = mkEnableOption "Renames the symbol under the cursor within the current scope (and current file).";
keymaps = {
smartRename = mkOption {
type = types.nullOr types.str;
default = "grr";
description = "rename symbol under the cursor";
};
};
};
navigation = {
inherit disable;
enable = mkEnableOption ''
Provides "go to definition" for the symbol under the cursor,
and lists the definitions from the current file.
'';
};
};
highlightCurrentScope = {
inherit disable;
enable = mkEnableOption "highlighting the block from the current scope where the cursor is";
};
smartRename = {
inherit disable;
enable =
mkEnableOption
"Renames the symbol under the cursor within the current scope (and current file).";
keymaps = {
smartRename = mkOption {
type = types.nullOr types.str;
default = "grr";
description = "rename symbol under the cursor";
};
};
};
navigation = {
inherit disable;
enable = mkEnableOption ''
Provides "go to definition" for the symbol under the cursor,
and lists the definitions from the current file.
'';
keymaps = {
gotoDefinition = mkOption {
type = types.nullOr types.str;
default = "gnd";
description = "go to the definition of the symbol under the cursor";
};
gotoDefinitionLspFallback = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
the symbol can not be resolved. You can use your own fallback function if create a
mapping for `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
'';
};
listDefinitions = mkOption {
type = types.nullOr types.str;
default = "gnD";
description = "list all definitions from the current file";
};
listDefinitionsToc = mkOption {
type = types.nullOr types.str;
default = "gO";
description = ''
list all definitions from the current file like a table of contents (similar to the one
you see when pressing |gO| in help files).
'';
};
gotoNextUsage = mkOption {
type = types.nullOr types.str;
default = "<a-*>";
description = "go to next usage of identifier under the cursor";
};
gotoPreviousUsage = mkOption {
type = types.nullOr types.str;
default = "<a-#>";
description = "go to previous usage of identifier";
keymaps = {
gotoDefinition = mkOption {
type = types.nullOr types.str;
default = "gnd";
description = "go to the definition of the symbol under the cursor";
};
gotoDefinitionLspFallback = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
the symbol can not be resolved. You can use your own fallback function if create a
mapping for `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
'';
};
listDefinitions = mkOption {
type = types.nullOr types.str;
default = "gnD";
description = "list all definitions from the current file";
};
listDefinitionsToc = mkOption {
type = types.nullOr types.str;
default = "gO";
description = ''
list all definitions from the current file like a table of contents (similar to the one
you see when pressing |gO| in help files).
'';
};
gotoNextUsage = mkOption {
type = types.nullOr types.str;
default = "<a-*>";
description = "go to next usage of identifier under the cursor";
};
gotoPreviousUsage = mkOption {
type = types.nullOr types.str;
default = "<a-#>";
description = "go to previous usage of identifier";
};
};
};
};
};
imports = [
# Added 2024-02-07
(mkRenamedOptionModule
["plugins" "treesitter-refactor" "navigation" "keymaps" "listDefinitons"]
["plugins" "treesitter-refactor" "navigation" "keymaps" "listDefinitions"])
[
"plugins"
"treesitter-refactor"
"navigation"
"keymaps"
"listDefinitons"
]
[
"plugins"
"treesitter-refactor"
"navigation"
"keymaps"
"listDefinitions"
]
)
# Added 2024-02-07
(mkRenamedOptionModule
["plugins" "treesitter-refactor" "navigation" "keymaps" "listDefinitonsToc"]
["plugins" "treesitter-refactor" "navigation" "keymaps" "listDefinitionsToc"])
[
"plugins"
"treesitter-refactor"
"navigation"
"keymaps"
"listDefinitonsToc"
]
[
"plugins"
"treesitter-refactor"
"navigation"
"keymaps"
"listDefinitionsToc"
]
)
];
config = let
cfg = config.plugins.treesitter-refactor;
in
config =
let
cfg = config.plugins.treesitter-refactor;
in
mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: treesitter-refactor needs treesitter to function as intended"
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.refactor = {
highlight_definitions = {
@ -128,20 +152,24 @@ with lib; {
highlight_current_scope = cfg.highlightCurrentScope;
smart_rename = {
inherit (cfg.smartRename) enable disable;
keymaps = {smart_rename = cfg.smartRename.keymaps.smartRename;};
keymaps = {
smart_rename = cfg.smartRename.keymaps.smartRename;
};
};
navigation = {
inherit (cfg.navigation) enable disable;
keymaps = let
cfgK = cfg.navigation.keymaps;
in {
goto_definition = cfgK.gotoDefinition;
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
list_definitions = cfgK.listDefinitions;
list_definitions_toc = cfgK.listDefinitionsToc;
goto_next_usage = cfgK.gotoNextUsage;
goto_previous_usage = cfgK.gotoPreviousUsage;
};
keymaps =
let
cfgK = cfg.navigation.keymaps;
in
{
goto_definition = cfgK.gotoDefinition;
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
list_definitions = cfgK.listDefinitions;
list_definitions_toc = cfgK.listDefinitionsToc;
goto_next_usage = cfgK.gotoNextUsage;
goto_previous_usage = cfgK.gotoPreviousUsage;
};
};
};
};

View file

@ -5,20 +5,20 @@
pkgs,
...
}:
with lib; {
options.plugins.treesitter-textobjects = let
disable = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
List of languages to disable this module for.
'';
with lib;
{
options.plugins.treesitter-textobjects =
let
disable = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
List of languages to disable this module for.
'';
mkKeymapsOption = desc:
helpers.defaultNullOpts.mkNullable
(
with types;
mkKeymapsOption =
desc:
helpers.defaultNullOpts.mkNullable (
with types;
attrsOf (
either
str
(submodule {
either str (submodule {
options = {
query = mkOption {
type = str;
@ -37,15 +37,11 @@ with lib; {
};
})
)
)
"{}"
desc;
in
) "{}" desc;
in
helpers.neovim-plugin.extraOptionsOptions
// {
enable =
mkEnableOption
"treesitter-textobjects (requires plugins.treesitter.enable to be true)";
enable = mkEnableOption "treesitter-textobjects (requires plugins.treesitter.enable to be true)";
package = helpers.mkPackageOption "treesitter-textobjects" pkgs.vimPlugins.nvim-treesitter-textobjects;
@ -70,19 +66,19 @@ with lib; {
selectionModes =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf
(
enum
["v" "V" "<c-v>"]
)
)
"{}"
''
Map of capture group to `v`(charwise), `V`(linewise), or `<c-v>`(blockwise), choose a
selection mode per capture, default is `v`(charwise).
'';
(
with types;
attrsOf (enum [
"v"
"V"
"<c-v>"
])
)
"{}"
''
Map of capture group to `v`(charwise), `V`(linewise), or `<c-v>`(blockwise), choose a
selection mode per capture, default is `v`(charwise).
'';
includeSurroundingWhitespace = helpers.defaultNullOpts.mkStrLuaFnOr types.bool "`false`" ''
`true` or `false`, when `true` textobjects are extended to include preceding or
@ -165,10 +161,14 @@ with lib; {
lspInterop = {
enable = helpers.defaultNullOpts.mkBool false "LSP interop.";
border =
helpers.defaultNullOpts.mkEnumFirstDefault
["none" "single" "double" "rounded" "solid" "shadow"]
"Define the style of the floating window border.";
border = helpers.defaultNullOpts.mkEnumFirstDefault [
"none"
"single"
"double"
"rounded"
"solid"
"shadow"
] "Define the style of the floating window border.";
peekDefinitionCode = mkKeymapsOption ''
Show textobject surrounding definition as determined using Neovim's built-in LSP in a
@ -177,67 +177,57 @@ with lib; {
(when https://github.com/neovim/neovim/pull/12720 or its successor is merged).
'';
floatingPreviewOpts =
helpers.defaultNullOpts.mkNullable
(with types; attrsOf anything)
"{}"
''
Options to pass to `vim.lsp.util.open_floating_preview`.
For example, `maximum_height`.
'';
floatingPreviewOpts = helpers.defaultNullOpts.mkNullable (with types; attrsOf anything) "{}" ''
Options to pass to `vim.lsp.util.open_floating_preview`.
For example, `maximum_height`.
'';
};
};
config = let
cfg = config.plugins.treesitter-textobjects;
in
config =
let
cfg = config.plugins.treesitter-textobjects;
in
mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: treesitter-textobjects needs treesitter to function as intended"
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.textobjects = with cfg; let
processKeymapsOpt = keymapsOptionValue:
helpers.ifNonNull' keymapsOptionValue
(
mapAttrs
(key: mapping:
if isString mapping
then mapping
else {
inherit (mapping) query;
query_group = mapping.queryGroup;
inherit (mapping) desc;
})
keymapsOptionValue
);
in
plugins.treesitter.moduleConfig.textobjects =
with cfg;
let
processKeymapsOpt =
keymapsOptionValue:
helpers.ifNonNull' keymapsOptionValue (
mapAttrs (
key: mapping:
if isString mapping then
mapping
else
{
inherit (mapping) query;
query_group = mapping.queryGroup;
inherit (mapping) desc;
}
) keymapsOptionValue
);
in
{
select = with select; {
inherit
enable
disable
lookahead
;
inherit enable disable lookahead;
keymaps = processKeymapsOpt keymaps;
selection_modes = selectionModes;
include_surrounding_whitespace = includeSurroundingWhitespace;
};
swap = with swap; {
inherit
enable
disable
;
inherit enable disable;
swap_next = processKeymapsOpt swapNext;
swap_previous = processKeymapsOpt swapPrevious;
};
move = with move; {
inherit
enable
disable
;
inherit enable disable;
set_jumps = setJumps;
goto_next_start = processKeymapsOpt gotoNextStart;
goto_next_end = processKeymapsOpt gotoNextEnd;
@ -247,10 +237,7 @@ with lib; {
goto_previous = processKeymapsOpt gotoPrevious;
};
lsp_interop = with lspInterop; {
inherit
enable
border
;
inherit enable border;
peek_definition_code = processKeymapsOpt peekDefinitionCode;
floating_preview_opts = floatingPreviewOpts;
};

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.treesitter;
in {
in
{
options = {
plugins.treesitter = {
enable = mkEnableOption "tree-sitter syntax highlighting";
@ -25,17 +27,19 @@ in {
};
ensureInstalled = mkOption {
type = with types; oneOf [(enum ["all"]) (listOf str)];
type =
with types;
oneOf [
(enum [ "all" ])
(listOf str)
];
default = "all";
description = "Either \"all\" or a list of languages";
};
gccPackage = mkOption {
type = with types; nullOr package;
default =
if cfg.nixGrammars
then null
else pkgs.gcc;
default = if cfg.nixGrammars then null else pkgs.gcc;
example = null;
description = ''
Which package (if any) to be added as the GCC compiler.
@ -46,10 +50,7 @@ in {
parserInstallDir = mkOption {
type = types.nullOr types.str;
default =
if cfg.nixGrammars
then null
else "$XDG_DATA_HOME/nvim/treesitter";
default = if cfg.nixGrammars then null else "$XDG_DATA_HOME/nvim/treesitter";
description = ''
Location of the parsers to be installed by the plugin (only needed when nixGrammars is disabled).
This default might not work on your own install, please make sure that $XDG_DATA_HOME is set if you want to use the default. Otherwise, change it to something that will work for you!
@ -58,37 +59,40 @@ in {
ignoreInstall = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = "List of parsers to ignore installing (for \"all\")";
};
disabledLanguages = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = "A list of languages to disable";
};
customCaptures = mkOption {
type = types.attrsOf types.str;
default = {};
default = { };
description = "Custom capture group highlighting";
};
incrementalSelection = let
keymap = default:
mkOption {
type = types.str;
inherit default;
incrementalSelection =
let
keymap =
default:
mkOption {
type = types.str;
inherit default;
};
in
{
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
keymaps = {
initSelection = keymap "gnn";
nodeIncremental = keymap "grn";
scopeIncremental = keymap "grc";
nodeDecremental = keymap "grm";
};
in {
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
keymaps = {
initSelection = keymap "gnn";
nodeIncremental = keymap "grn";
scopeIncremental = keymap "grc";
nodeDecremental = keymap "grm";
};
};
indent = mkEnableOption "tree-sitter based indentation";
@ -101,10 +105,13 @@ in {
Register specific parsers to one or several filetypes.
The keys are the parser names and the values are either one or several filetypes.
'';
default = {};
default = { };
example = {
cpp = "onelab";
python = ["myFiletype" "anotherFiletype"];
python = [
"myFiletype"
"anotherFiletype"
];
};
};
@ -116,61 +123,45 @@ in {
moduleConfig = mkOption {
type = types.attrsOf types.anything;
default = {};
default = { };
description = "This is the configuration for extra modules. It should not be used directly";
};
nixvimInjections =
mkEnableOption
"nixvim specific injections, like lua highlighting in extraConfigLua";
nixvimInjections = mkEnableOption "nixvim specific injections, like lua highlighting in extraConfigLua";
};
};
config = let
tsOptions =
{
config =
let
tsOptions = {
highlight = {
inherit (cfg) enable;
disable =
if (cfg.disabledLanguages != [])
then cfg.disabledLanguages
else null;
disable = if (cfg.disabledLanguages != [ ]) then cfg.disabledLanguages else null;
custom_captures =
if (cfg.customCaptures != {})
then cfg.customCaptures
else null;
custom_captures = if (cfg.customCaptures != { }) then cfg.customCaptures else null;
};
incremental_selection =
if cfg.incrementalSelection.enable
then {
enable = true;
keymaps = {
init_selection = cfg.incrementalSelection.keymaps.initSelection;
node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental;
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
};
}
else null;
if cfg.incrementalSelection.enable then
{
enable = true;
keymaps = {
init_selection = cfg.incrementalSelection.keymaps.initSelection;
node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental;
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
};
}
else
null;
indent =
if cfg.indent
then {
enable = true;
}
else null;
indent = if cfg.indent then { enable = true; } else null;
ensure_installed =
if cfg.nixGrammars
then []
else cfg.ensureInstalled;
ensure_installed = if cfg.nixGrammars then [ ] else cfg.ensureInstalled;
ignore_install = cfg.ignoreInstall;
parser_install_dir = cfg.parserInstallDir;
}
// cfg.moduleConfig;
in
} // cfg.moduleConfig;
in
mkIf cfg.enable {
extraConfigLua =
(optionalString (cfg.parserInstallDir != null) ''
@ -179,7 +170,7 @@ in {
+ ''
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
''
+ (optionalString (cfg.languageRegister != {}) ''
+ (optionalString (cfg.languageRegister != { }) ''
__parserFiletypeMappings = ${helpers.toLuaObject cfg.languageRegister}
for parser_name, ft in pairs(__parserFiletypeMappings) do
@ -210,9 +201,7 @@ in {
};
extraPlugins =
if cfg.nixGrammars
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
else [cfg.package];
if cfg.nixGrammars then [ (cfg.package.withPlugins (_: cfg.grammarPackages)) ] else [ cfg.package ];
extraPackages = with pkgs; [
tree-sitter
nodejs

View file

@ -5,84 +5,74 @@
config,
...
}:
with lib; {
options.plugins.ts-autotag =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "nvim-ts-autotag";
with lib;
{
options.plugins.ts-autotag = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-ts-autotag";
package = helpers.mkPackageOption "ts-autotag" pkgs.vimPlugins.nvim-ts-autotag;
package = helpers.mkPackageOption "ts-autotag" pkgs.vimPlugins.nvim-ts-autotag;
filetypes =
helpers.defaultNullOpts.mkNullable
(with types; listOf str)
''
[
"html"
"javascript"
"typescript"
"javascriptreact"
"typescriptreact"
"svelte"
"vue"
"tsx"
"jsx"
"rescript"
"xml"
"php"
"markdown"
"astro"
"glimmer"
"handlebars"
"hbs"
]
''
"Filetypes for which ts-autotag should be enabled.";
filetypes = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''
[
"html"
"javascript"
"typescript"
"javascriptreact"
"typescriptreact"
"svelte"
"vue"
"tsx"
"jsx"
"rescript"
"xml"
"php"
"markdown"
"astro"
"glimmer"
"handlebars"
"hbs"
]
'' "Filetypes for which ts-autotag should be enabled.";
skipTags =
helpers.defaultNullOpts.mkNullable
(with types; listOf str)
''
[
"area"
"base"
"br"
"col"
"command"
"embed"
"hr"
"img"
"slot"
"input"
"keygen"
"link"
"meta"
"param"
"source"
"track"
"wbr"
"menuitem"
]
''
"Which tags to skip.";
};
skipTags = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''
[
"area"
"base"
"br"
"col"
"command"
"embed"
"hr"
"img"
"slot"
"input"
"keygen"
"link"
"meta"
"param"
"source"
"track"
"wbr"
"menuitem"
]
'' "Which tags to skip.";
};
config = let
cfg = config.plugins.ts-autotag;
in
config =
let
cfg = config.plugins.ts-autotag;
in
mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: ts-autotag needs treesitter to function as intended"
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.autotag =
{
enable = true;
inherit (cfg) filetypes;
skip_tags = cfg.skipTags;
}
// cfg.extraOptions;
plugins.treesitter.moduleConfig.autotag = {
enable = true;
inherit (cfg) filetypes;
skip_tags = cfg.skipTags;
} // cfg.extraOptions;
};
}

View file

@ -5,71 +5,55 @@
pkgs,
...
}:
with lib; {
options.plugins.ts-context-commentstring =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "nvim-ts-context-commentstring";
with lib;
{
options.plugins.ts-context-commentstring = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-ts-context-commentstring";
package =
helpers.mkPackageOption
"ts-context-commentstring"
pkgs.vimPlugins.nvim-ts-context-commentstring;
package = helpers.mkPackageOption "ts-context-commentstring" pkgs.vimPlugins.nvim-ts-context-commentstring;
skipTsContextCommentStringModule = mkOption {
type = types.bool;
default = true;
description = ''
Whether to skip backwards compatibility routines and speed up loading.
'';
example = false;
};
disableAutoInitialization = helpers.defaultNullOpts.mkBool false ''
Whether to disable auto-initialization.
skipTsContextCommentStringModule = mkOption {
type = types.bool;
default = true;
description = ''
Whether to skip backwards compatibility routines and speed up loading.
'';
languages =
helpers.mkNullOrOption
(
with types;
attrsOf
(
either
str
(attrsOf str)
)
)
''
Allows you to add support for more languages.
See `:h ts-context-commentstring-commentstring-configuration` for more information.
'';
example = false;
};
config = let
cfg = config.plugins.ts-context-commentstring;
in
disableAutoInitialization = helpers.defaultNullOpts.mkBool false ''
Whether to disable auto-initialization.
'';
languages = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
Allows you to add support for more languages.
See `:h ts-context-commentstring-commentstring-configuration` for more information.
'';
};
config =
let
cfg = config.plugins.ts-context-commentstring;
in
mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [
"Nixvim: ts-context-commentstring needs treesitter to function as intended"
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals = with cfg; {
skip_ts_context_commentstring_module = skipTsContextCommentStringModule;
loaded_ts_context_commentstring = disableAutoInitialization;
};
extraConfigLua = let
setupOptions = with cfg;
{
inherit languages;
}
// cfg.extraOptions;
in ''
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions})
'';
extraConfigLua =
let
setupOptions = with cfg; { inherit languages; } // cfg.extraOptions;
in
''
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -5,18 +5,16 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.typescript-tools;
in {
in
{
options.plugins.typescript-tools = {
enable = mkEnableOption "typescript-tools";
package =
helpers.mkPackageOption "typescript-tools"
pkgs.vimPlugins.typescript-tools-nvim;
package = helpers.mkPackageOption "typescript-tools" pkgs.vimPlugins.typescript-tools-nvim;
onAttach =
helpers.defaultNullOpts.mkLuaFn "__lspOnAttach"
"Lua code to run when tsserver attaches to a buffer.";
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Lua code to run when tsserver attaches to a buffer.";
handlers = mkOption {
type = with helpers.nixvimTypes; nullOr (attrsOf strLuaFn);
apply = v: helpers.ifNonNull' v (mapAttrs (_: helpers.mkRaw) v);
@ -33,27 +31,33 @@ in {
};
settings = {
separateDiagnosticServer =
helpers.defaultNullOpts.mkBool true
"Spawns an additional tsserver instance to calculate diagnostics";
separateDiagnosticServer = helpers.defaultNullOpts.mkBool true "Spawns an additional tsserver instance to calculate diagnostics";
publishDiagnosticOn =
helpers.defaultNullOpts.mkEnum ["change" "insert_leave"]
"insert_leave" ''
Either "change" or "insert_leave". Determines when the client asks the server about diagnostics
'';
helpers.defaultNullOpts.mkEnum
[
"change"
"insert_leave"
]
"insert_leave"
''
Either "change" or "insert_leave". Determines when the client asks the server about diagnostics
'';
exposeAsCodeAction = mkOption {
type = with types;
either (enum ["all"]) (listOf (enum [
"fix_all"
"add_missing_imports"
"remove_unused"
"remove_unused_imports"
"organize_imports"
"insert_leave"
]));
default = [];
type =
with types;
either (enum [ "all" ]) (
listOf (enum [
"fix_all"
"add_missing_imports"
"remove_unused"
"remove_unused_imports"
"organize_imports"
"insert_leave"
])
);
default = [ ];
description = "Specify what to expose as code actions.";
};
@ -62,17 +66,19 @@ in {
doesn't exist then standard path resolution strategy is applied
'';
tsserverPlugins = with helpers.nixvimTypes;
tsserverPlugins =
with helpers.nixvimTypes;
helpers.mkNullOrOption (listOf (maybeRaw str)) ''
List of plugins for tsserver to load. See this plugins's README
at https://github.com/pmizio/typescript-tools.nvim/#-styled-components-support
'';
tsserverMaxMemory = helpers.mkNullOrOption (with helpers.nixvimTypes;
maybeRaw (either ints.unsigned (enum ["auto"]))) ''
This value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
Memory limit in megabytes or "auto"(basically no limit)
'';
tsserverMaxMemory =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (either ints.unsigned (enum [ "auto" ])))
''
This value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
Memory limit in megabytes or "auto"(basically no limit)
'';
tsserverFormatOptions = mkOption {
type = with types; nullOr (attrsOf anything);
@ -117,13 +123,15 @@ in {
'';
codeLens =
helpers.defaultNullOpts.mkEnum [
helpers.defaultNullOpts.mkEnum
[
"off"
"all"
"implementations_only"
"references_only"
]
"off"
"all"
"implementations_only"
"references_only"
] "off"
"WARNING: Experimental feature also in VSCode, disabled by default because it might impact server performance.";
"WARNING: Experimental feature also in VSCode, disabled by default because it might impact server performance.";
disableMemberCodeLens = helpers.defaultNullOpts.mkBool true ''
By default code lenses are displayed on all referenceable values. Display less by removing member references from lenses.
@ -133,11 +141,9 @@ in {
enable = helpers.defaultNullOpts.mkBool false ''
Functions similarly to `nvim-ts-autotag`. This is disabled by default to avoid conflicts.
'';
filetypes =
helpers.defaultNullOpts.mkListOf types.str
''["javascriptreact" "typescriptreact"]'' ''
Filetypes this should apply to.
'';
filetypes = helpers.defaultNullOpts.mkListOf types.str ''["javascriptreact" "typescriptreact"]'' ''
Filetypes this should apply to.
'';
};
};
};
@ -148,31 +154,35 @@ in {
nvim-lspconfig
];
plugins.lsp.postConfig = with cfg; let
options = {
inherit handlers;
on_attach = onAttach;
plugins.lsp.postConfig =
with cfg;
let
options = {
inherit handlers;
on_attach = onAttach;
settings = with settings; {
separate_diagnostic_server = separateDiagnosticServer;
publish_diagnostic_on = publishDiagnosticOn;
expose_as_code_action = exposeAsCodeAction;
tsserver_path = tsserverPath;
tsserver_plugins = tsserverPlugins;
tsserver_max_memory = tsserverMaxMemory;
tsserver_format_options = tsserverFormatOptions;
tsserver_file_preferences = tsserverFilePreferences;
tsserver_locale = tsserverLocale;
complete_function_calls = completeFunctionCalls;
include_completions_with_insert_text =
includeCompletionsWithInsertText;
code_lens = codeLens;
disable_member_code_lens = disableMemberCodeLens;
jsx_close_tag = with jsxCloseTag; {inherit enable filetypes;};
settings = with settings; {
separate_diagnostic_server = separateDiagnosticServer;
publish_diagnostic_on = publishDiagnosticOn;
expose_as_code_action = exposeAsCodeAction;
tsserver_path = tsserverPath;
tsserver_plugins = tsserverPlugins;
tsserver_max_memory = tsserverMaxMemory;
tsserver_format_options = tsserverFormatOptions;
tsserver_file_preferences = tsserverFilePreferences;
tsserver_locale = tsserverLocale;
complete_function_calls = completeFunctionCalls;
include_completions_with_insert_text = includeCompletionsWithInsertText;
code_lens = codeLens;
disable_member_code_lens = disableMemberCodeLens;
jsx_close_tag = with jsxCloseTag; {
inherit enable filetypes;
};
};
};
};
in ''
require('typescript-tools').setup(${helpers.toLuaObject options})
'';
in
''
require('typescript-tools').setup(${helpers.toLuaObject options})
'';
};
}

View file

@ -6,81 +6,78 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "typst-vim";
originalName = "typst.vim";
defaultPackage = pkgs.vimPlugins.typst-vim;
globalPrefix = "typst_";
helpers.vim-plugin.mkVimPlugin config {
name = "typst-vim";
originalName = "typst.vim";
defaultPackage = pkgs.vimPlugins.typst-vim;
globalPrefix = "typst_";
# Add the typst compiler to nixvim packages
extraPackages = [pkgs.typst];
# Add the typst compiler to nixvim packages
extraPackages = [ pkgs.typst ];
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"cmd"
"pdfViewer"
"concealMath"
"autoCloseToc"
];
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"cmd"
"pdfViewer"
"concealMath"
"autoCloseToc"
];
extraOptions = {
keymaps = {
silent = mkOption {
type = types.bool;
description = "Whether typst-vim keymaps should be silent.";
default = false;
};
watch =
helpers.mkNullOrOption types.str
"Keymap to preview the document and recompile on change.";
extraOptions = {
keymaps = {
silent = mkOption {
type = types.bool;
description = "Whether typst-vim keymaps should be silent.";
default = false;
};
};
extraConfig = cfg: {
keymaps = with cfg.keymaps;
helpers.keymaps.mkKeymaps
watch = helpers.mkNullOrOption types.str "Keymap to preview the document and recompile on change.";
};
};
extraConfig = cfg: {
keymaps =
with cfg.keymaps;
helpers.keymaps.mkKeymaps
{
mode = "n";
options.silent = silent;
}
(
optional
(watch != null)
{
optional (watch != null) {
# mode = "n";
key = watch;
action = ":TypstWatch<CR>";
}
);
};
};
settingsOptions = {
cmd = helpers.defaultNullOpts.mkStr "typst" ''
Specifies the location of the Typst executable.
'';
settingsOptions = {
cmd = helpers.defaultNullOpts.mkStr "typst" ''
Specifies the location of the Typst executable.
'';
pdf_viewer = helpers.mkNullOrOption types.str ''
Specifies pdf viewer that `typst watch --open` will use.
'';
pdf_viewer = helpers.mkNullOrOption types.str ''
Specifies pdf viewer that `typst watch --open` will use.
'';
conceal_math = helpers.defaultNullOpts.mkBool false ''
Enable concealment for math symbols in math mode (i.e. replaces symbols with their actual
unicode character).
Warning: this can affect performance
'';
conceal_math = helpers.defaultNullOpts.mkBool false ''
Enable concealment for math symbols in math mode (i.e. replaces symbols with their actual
unicode character).
Warning: this can affect performance
'';
auto_close_toc = helpers.defaultNullOpts.mkBool false ''
Specifies whether TOC will be automatically closed after using it.
'';
};
auto_close_toc = helpers.defaultNullOpts.mkBool false ''
Specifies whether TOC will be automatically closed after using it.
'';
};
settingsExample = {
cmd = "typst";
conceal_math = true;
auto_close_toc = true;
};
}
settingsExample = {
cmd = "typst";
conceal_math = true;
auto_close_toc = true;
};
}

View file

@ -7,113 +7,102 @@
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "vim-slime";
defaultPackage = pkgs.vimPlugins.vim-slime;
globalPrefix = "slime_";
mkVimPlugin config {
name = "vim-slime";
defaultPackage = pkgs.vimPlugins.vim-slime;
globalPrefix = "slime_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"target"
"vimterminalCmd"
"noMappings"
"pasteFile"
"preserveCurpos"
"defaultConfig"
"dontAskDefault"
"bracketedPaste"
];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"target"
"vimterminalCmd"
"noMappings"
"pasteFile"
"preserveCurpos"
"defaultConfig"
"dontAskDefault"
"bracketedPaste"
];
settingsOptions = {
target =
helpers.defaultNullOpts.mkEnum
[
"dtach"
"kitty"
"neovim"
"screen"
"tmux"
"vimterminal"
"wezterm"
"whimrepl"
"x11"
"zellij"
]
"screen"
"Which backend vim-slime should use.";
settingsOptions = {
target = helpers.defaultNullOpts.mkEnum [
"dtach"
"kitty"
"neovim"
"screen"
"tmux"
"vimterminal"
"wezterm"
"whimrepl"
"x11"
"zellij"
] "screen" "Which backend vim-slime should use.";
vimterminal_cmd = helpers.mkNullOrStr ''
The vim terminal command to execute.
'';
vimterminal_cmd = helpers.mkNullOrStr ''
The vim terminal command to execute.
'';
no_mappings = helpers.defaultNullOpts.mkBool false ''
Whether to disable the default mappings.
'';
no_mappings = helpers.defaultNullOpts.mkBool false ''
Whether to disable the default mappings.
'';
paste_file = helpers.defaultNullOpts.mkStr "$HOME/.slime_paste" ''
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.
'';
paste_file = helpers.defaultNullOpts.mkStr "$HOME/.slime_paste" ''
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.
'';
preserve_curpos = helpers.defaultNullOpts.mkBool true ''
Whether to preserve cursor position when sending a line or paragraph.
'';
preserve_curpos = helpers.defaultNullOpts.mkBool true ''
Whether to preserve cursor position when sending a line or paragraph.
'';
default_config =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
attrsOf
(either str rawLua)
)
''
Pre-filled prompt answer.
default_config = helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf (either str rawLua)) ''
Pre-filled prompt answer.
Examples:
- `tmux`:
```nix
{
socket_name = "default";
target_pane = "{last}";
}
```
- `zellij`:
```nix
{
session_id = "current";
relative_pane = "right";
}
```
'';
Examples:
- `tmux`:
```nix
{
socket_name = "default";
target_pane = "{last}";
}
```
- `zellij`:
```nix
{
session_id = "current";
relative_pane = "right";
}
```
'';
dont_ask_default = helpers.defaultNullOpts.mkBool false ''
Whether to bypass the prompt and use the specified default configuration options.
'';
dont_ask_default = helpers.defaultNullOpts.mkBool false ''
Whether to bypass the prompt and use the specified default configuration options.
'';
bracketed_paste = helpers.defaultNullOpts.mkBool false ''
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.
'';
bracketed_paste = helpers.defaultNullOpts.mkBool false ''
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.
'';
};
settingsExample = {
target = "screen";
vimterminal_cmd = null;
no_mappings = false;
paste_file = "$HOME/.slime_paste";
preserve_curpos = true;
default_config = {
socket_name = "default";
target_pane = "{last}";
};
settingsExample = {
target = "screen";
vimterminal_cmd = null;
no_mappings = false;
paste_file = "$HOME/.slime_paste";
preserve_curpos = true;
default_config = {
socket_name = "default";
target_pane = "{last}";
};
dont_ask_default = false;
bracketed_paste = false;
};
}
dont_ask_default = false;
bracketed_paste = false;
};
}

View file

@ -6,90 +6,86 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "vimtex";
defaultPackage = pkgs.vimPlugins.vimtex;
globalPrefix = "vimtex_";
helpers.vim-plugin.mkVimPlugin config {
name = "vimtex";
defaultPackage = pkgs.vimPlugins.vimtex;
globalPrefix = "vimtex_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraPackages = [pkgs.pstree];
extraPackages = [ pkgs.pstree ];
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"viewMethod"
];
imports = let
basePluginPath = ["plugins" "vimtex"];
in [
(
mkRemovedOptionModule
(basePluginPath ++ ["installTexLive"])
"If you don't want `texlive` to be installed, set `plugins.vimtex.texlivePackage` to `null`."
)
(
mkRenamedOptionModule
(basePluginPath ++ ["texLivePackage"])
(basePluginPath ++ ["texlivePackage"])
)
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [ "viewMethod" ];
imports =
let
basePluginPath = [
"plugins"
"vimtex"
];
in
[
(mkRemovedOptionModule (
basePluginPath ++ [ "installTexLive" ]
) "If you don't want `texlive` to be installed, set `plugins.vimtex.texlivePackage` to `null`.")
(mkRenamedOptionModule (basePluginPath ++ [ "texLivePackage" ]) (
basePluginPath ++ [ "texlivePackage" ]
))
];
settingsOptions = {
view_method = mkOption {
type = types.str;
default = "general";
example = "zathura";
description = ''
Set the viewer method.
By default, a generic viewer is used through the general view method (e.g. `xdg-open` on Linux).
'';
};
settingsOptions = {
view_method = mkOption {
type = types.str;
default = "general";
example = "zathura";
description = ''
Set the viewer method.
By default, a generic viewer is used through the general view method (e.g. `xdg-open` on Linux).
'';
};
};
settingsExample = {
view_method = "zathura";
compiler_method = "latexrun";
toc_config = {
split_pos = "vert topleft";
split_width = 40;
};
};
extraOptions = {
texlivePackage = mkOption {
type = with types; nullOr package;
default = pkgs.texlive.combined.scheme-medium;
example = null;
description = ''
The package to install for `textlive.
Set to `null` for not installing `texlive` at all.
'';
};
};
extraConfig = cfg: {
plugins.vimtex.settings = {
enabled = true;
callback_progpath = "nvim";
};
settingsExample = {
view_method = "zathura";
compiler_method = "latexrun";
toc_config = {
split_pos = "vert topleft";
split_width = 40;
};
};
extraOptions = {
texlivePackage = mkOption {
type = with types; nullOr package;
default = pkgs.texlive.combined.scheme-medium;
example = null;
description = ''
The package to install for `textlive.
Set to `null` for not installing `texlive` at all.
'';
};
};
extraConfig = cfg: {
plugins.vimtex.settings = {
enabled = true;
callback_progpath = "nvim";
};
extraPackages = let
extraPackages =
let
# xdotool does not exist on darwin
xdotool = optional pkgs.stdenv.isLinux pkgs.xdotool;
viewerPackages =
{
general = xdotool;
zathura = xdotool ++ [pkgs.zathura];
zathura_simple = [pkgs.zathura];
mupdf = xdotool ++ [pkgs.mupdf];
zathura = xdotool ++ [ pkgs.zathura ];
zathura_simple = [ pkgs.zathura ];
mupdf = xdotool ++ [ pkgs.mupdf ];
}
.${cfg.settings.view_method}
or [];
.${cfg.settings.view_method} or [ ];
in
[
cfg.texlivePackage
]
++ viewerPackages;
};
}
[ cfg.texlivePackage ] ++ viewerPackages;
};
}

View file

@ -7,32 +7,40 @@
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "zig";
originalName = "zig.vim";
defaultPackage = pkgs.vimPlugins.zig-vim;
globalPrefix = "zig_";
mkVimPlugin config {
name = "zig";
originalName = "zig.vim";
defaultPackage = pkgs.vimPlugins.zig-vim;
globalPrefix = "zig_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
imports = [
(
mkRenamedOptionModule
["plugins" "zig" "formatOnSave"]
["plugins" "zig" "settings" "fmt_autosave"]
)
];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
imports = [
(mkRenamedOptionModule
[
"plugins"
"zig"
"formatOnSave"
]
[
"plugins"
"zig"
"settings"
"fmt_autosave"
]
)
];
settingsOptions = {
fmt_autosave = helpers.defaultNullOpts.mkBool true ''
This plugin enables automatic code formatting on save by default using zig fmt.
To disable it, you can set this option to `false`.
'';
};
settingsOptions = {
fmt_autosave = helpers.defaultNullOpts.mkBool true ''
This plugin enables automatic code formatting on save by default using zig fmt.
To disable it, you can set this option to `false`.
'';
};
settingsExample = {
fmt_autosave = false;
};
}
settingsExample = {
fmt_autosave = false;
};
}