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

@ -10,7 +10,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
originalName = "my-plugin.nvim"; # TODO replace (or remove entirely if it is the same as `name`)
defaultPackage = pkgs.vimPlugins.my-plugin-nvim; # TODO replace
maintainers = [lib.maintainers.MyName]; # TODO replace with your name
maintainers = [ lib.maintainers.MyName ]; # TODO replace with your name
# Optionally, explicitly declare some options. You don't have to.
settingsOptions = {

View file

@ -5,7 +5,8 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.barbar;
bufferOptions = {
@ -14,30 +15,31 @@ with lib; let
buffers in the tabline.
'';
bufferNumber =
helpers.mkNullOrOption types.bool
"Whether to show the `bufnr` for the associated buffer.";
bufferNumber = helpers.mkNullOrOption types.bool "Whether to show the `bufnr` for the associated buffer.";
button =
helpers.mkNullOrOption (with types; either str (enum [false]))
"the button which is clicked to close / save a buffer, or indicate that it is pinned.";
button = helpers.mkNullOrOption (
with types; either str (enum [ false ])
) "the button which is clicked to close / save a buffer, or indicate that it is pinned.";
diagnostics =
genAttrs
["error" "warn" "info" "hint"]
(
name:
[
"error"
"warn"
"info"
"hint"
]
(
name:
helpers.mkCompositeOption "${name} diagnostic icon." {
enable = helpers.defaultNullOpts.mkBool false "Enable the ${name} diagnostic symbol";
icon = helpers.mkNullOrOption types.str "${name} diagnostic symbol";
}
);
);
filetype = {
customColors =
helpers.defaultNullOpts.mkBool false
"Sets the icon's highlight group. If false, will use nvim-web-devicons colors";
customColors = helpers.defaultNullOpts.mkBool false "Sets the icon's highlight group. If false, will use nvim-web-devicons colors";
enable = helpers.defaultNullOpts.mkBool true "Show the filetype icon.";
};
@ -48,12 +50,10 @@ with lib; let
};
};
stateOptions =
{
modified = bufferOptions;
pinned = bufferOptions;
}
// bufferOptions;
stateOptions = {
modified = bufferOptions;
pinned = bufferOptions;
} // bufferOptions;
keymapsActions = {
previous = "Previous";
@ -78,160 +78,141 @@ with lib; let
orderByLanguage = "OrderByLanguage";
orderByWindowNumber = "OrderByWindowNumber";
};
in {
options.plugins.barbar =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "barbar.nvim";
in
{
options.plugins.barbar = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "barbar.nvim";
package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
animation = helpers.defaultNullOpts.mkBool true "Enable/disable animations";
animation = helpers.defaultNullOpts.mkBool true "Enable/disable animations";
autoHide =
helpers.defaultNullOpts.mkBool false
"Enable/disable auto-hiding the tab bar when there is a single buffer.";
autoHide = helpers.defaultNullOpts.mkBool false "Enable/disable auto-hiding the tab bar when there is a single buffer.";
tabpages =
helpers.defaultNullOpts.mkBool true
"Enable/disable current/total tabpages indicator (top right corner).";
tabpages = helpers.defaultNullOpts.mkBool true "Enable/disable current/total tabpages indicator (top right corner).";
clickable = helpers.defaultNullOpts.mkBool true ''
Enable clickable tabs
- left-click: go to buffer
- middle-click: delete buffer
'';
clickable = helpers.defaultNullOpts.mkBool true ''
Enable clickable tabs
- left-click: go to buffer
- middle-click: delete buffer
'';
excludeFileTypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Excludes buffers of certain filetypes from the tabline
'';
excludeFileTypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Excludes buffers of certain filetypes from the tabline
'';
excludeFileNames = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Excludes buffers with certain filenames from the tabline
'';
excludeFileNames = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Excludes buffers with certain filenames from the tabline
'';
focusOnClose =
helpers.defaultNullOpts.mkEnumFirstDefault ["left" "right"]
focusOnClose =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"left"
"right"
]
''
A buffer to this direction will be focused (if it exists) when closing the current buffer.
'';
highlightAlternate = helpers.defaultNullOpts.mkBool false "Highlight alternate buffers";
highlightAlternate = helpers.defaultNullOpts.mkBool false "Highlight alternate buffers";
highlightInactiveFileIcons =
helpers.defaultNullOpts.mkBool false
"Highlight file icons in inactive buffers";
highlightInactiveFileIcons = helpers.defaultNullOpts.mkBool false "Highlight file icons in inactive buffers";
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
icons =
stateOptions
// (
mapAttrs
(name: description:
mkOption {
type = types.submodule {
options = stateOptions;
};
default = {};
inherit description;
})
{
alternate = "The icons used for an alternate buffer.";
current = "The icons for the current buffer.";
inactive = "The icons for inactive buffers.";
visible = "The icons for visible buffers.";
}
);
hide = {
alternate = helpers.mkNullOrOption types.bool "Hide alternate buffers";
current = helpers.mkNullOrOption types.bool "Hide current buffer";
extensions = helpers.mkNullOrOption types.bool "Hide file extensions";
inactive = helpers.mkNullOrOption types.bool "Hide inactive buffers";
visible = helpers.mkNullOrOption types.bool "Hide visible buffers";
};
insertAtEnd = helpers.defaultNullOpts.mkBool false ''
If true, new buffers will be inserted at the end of the list.
Default is to insert after current buffer.
'';
insertAtStart = helpers.defaultNullOpts.mkBool false ''
If true, new buffers will be inserted at the start of the list.
Default is to insert after current buffer.
'';
maximumPadding =
helpers.defaultNullOpts.mkInt 4
"Sets the maximum padding width with which to surround each tab";
minimumPadding =
helpers.defaultNullOpts.mkInt 1
"Sets the minimum padding width with which to surround each tab";
maximumLength =
helpers.defaultNullOpts.mkInt 30
"Sets the maximum buffer name length.";
semanticLetters = helpers.defaultNullOpts.mkBool true ''
If set, the letters for each buffer in buffer-pick mode will be assigned based on their
name.
Otherwise or in case all letters are already assigned, the behavior is to assign letters in
order of usability (see `letters` option)
'';
letters =
helpers.defaultNullOpts.mkStr
"asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP"
''
New buffer letters are assigned in this order.
This order is optimal for the qwerty keyboard layout but might need adjustment for other layouts.
'';
sidebarFiletypes =
helpers.mkNullOrOption
icons =
stateOptions
// (mapAttrs
(
with types;
attrsOf (
either
(enum [true])
(types.submodule {
options = {
text = helpers.mkNullOrOption types.str "The text used for the offset";
event =
helpers.mkNullOrOption types.str
"The event which the sidebar executes when leaving.";
};
})
)
name: description:
mkOption {
type = types.submodule { options = stateOptions; };
default = { };
inherit description;
}
)
"Set the filetypes which barbar will offset itself for";
noNameTitle = helpers.mkNullOrOption types.str ''
Sets the name of unnamed buffers.
By default format is "[Buffer X]" where X is the buffer number.
But only a static string is accepted here.
'';
keymaps =
{
silent = mkEnableOption "silent keymaps for barbar";
alternate = "The icons used for an alternate buffer.";
current = "The icons for the current buffer.";
inactive = "The icons for inactive buffers.";
visible = "The icons for visible buffers.";
}
// (
mapAttrs
(
optionName: funcName:
helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
)
keymapsActions
);
);
hide = {
alternate = helpers.mkNullOrOption types.bool "Hide alternate buffers";
current = helpers.mkNullOrOption types.bool "Hide current buffer";
extensions = helpers.mkNullOrOption types.bool "Hide file extensions";
inactive = helpers.mkNullOrOption types.bool "Hide inactive buffers";
visible = helpers.mkNullOrOption types.bool "Hide visible buffers";
};
config = let
setupOptions =
insertAtEnd = helpers.defaultNullOpts.mkBool false ''
If true, new buffers will be inserted at the end of the list.
Default is to insert after current buffer.
'';
insertAtStart = helpers.defaultNullOpts.mkBool false ''
If true, new buffers will be inserted at the start of the list.
Default is to insert after current buffer.
'';
maximumPadding =
helpers.defaultNullOpts.mkInt 4
"Sets the maximum padding width with which to surround each tab";
minimumPadding =
helpers.defaultNullOpts.mkInt 1
"Sets the minimum padding width with which to surround each tab";
maximumLength = helpers.defaultNullOpts.mkInt 30 "Sets the maximum buffer name length.";
semanticLetters = helpers.defaultNullOpts.mkBool true ''
If set, the letters for each buffer in buffer-pick mode will be assigned based on their
name.
Otherwise or in case all letters are already assigned, the behavior is to assign letters in
order of usability (see `letters` option)
'';
letters = helpers.defaultNullOpts.mkStr "asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP" ''
New buffer letters are assigned in this order.
This order is optimal for the qwerty keyboard layout but might need adjustment for other layouts.
'';
sidebarFiletypes = helpers.mkNullOrOption (
with types;
attrsOf (
either (enum [ true ]) (
types.submodule {
options = {
text = helpers.mkNullOrOption types.str "The text used for the offset";
event = helpers.mkNullOrOption types.str "The event which the sidebar executes when leaving.";
};
}
)
)
) "Set the filetypes which barbar will offset itself for";
noNameTitle = helpers.mkNullOrOption types.str ''
Sets the name of unnamed buffers.
By default format is "[Buffer X]" where X is the buffer number.
But only a static string is accepted here.
'';
keymaps =
{
silent = mkEnableOption "silent keymaps for barbar";
}
// (mapAttrs (
optionName: funcName: helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
) keymapsActions);
};
config =
let
setupOptions = {
inherit (cfg) animation;
auto_hide = cfg.autoHide;
inherit (cfg) tabpages;
@ -242,74 +223,58 @@ in {
highlight_alternate = cfg.highlightAlternate;
highlight_inactive_file_icons = cfg.highlightInactiveFileIcons;
highlight_visible = cfg.highlightVisible;
icons = let
handleBufferOption = bufferOption:
with bufferOption; {
buffer_index = bufferIndex;
buffer_number = bufferNumber;
inherit button;
diagnostics =
/*
Because the keys of this lua table are not strings (but
`vim.diagnostic.severity.XXXX`), we have to manually build a raw lua string here.
*/
let
setIcons = filterAttrs (n: v: v != null) cfg.icons.diagnostics;
setIconsList =
mapAttrsToList
(name: value: {
icons =
let
handleBufferOption =
bufferOption: with bufferOption; {
buffer_index = bufferIndex;
buffer_number = bufferNumber;
inherit button;
diagnostics =
/*
Because the keys of this lua table are not strings (but
`vim.diagnostic.severity.XXXX`), we have to manually build a raw lua string here.
*/
let
setIcons = filterAttrs (n: v: v != null) cfg.icons.diagnostics;
setIconsList = mapAttrsToList (name: value: {
key = "vim.diagnostic.severity.${strings.toUpper name}";
value = helpers.ifNonNull' value (helpers.toLuaObject {
enabled = value.enable;
inherit (value) icon;
});
})
setIcons;
in
value = helpers.ifNonNull' value (
helpers.toLuaObject {
enabled = value.enable;
inherit (value) icon;
}
);
}) setIcons;
in
helpers.mkRaw (
"{"
+ concatStringsSep ","
(
map
(iconOption: "[${iconOption.key}] = ${iconOption.value}")
setIconsList
)
+ concatStringsSep "," (map (iconOption: "[${iconOption.key}] = ${iconOption.value}") setIconsList)
+ "}"
);
filetype = with filetype; {
custom_color = customColors;
enabled = enable;
filetype = with filetype; {
custom_color = customColors;
enabled = enable;
};
inherit separator;
};
inherit separator;
};
handleStateOption = stateOption:
with stateOption;
handleStateOption =
stateOption:
with stateOption;
{
modified = handleBufferOption modified;
pinned = handleBufferOption pinned;
}
// (
handleBufferOption
(
getAttrs (attrNames stateOption)
stateOption
)
);
in
(
handleStateOption
(
getAttrs
(attrNames stateOptions)
cfg.icons
)
)
// (
genAttrs
["alternate" "current" "inactive" "visible"]
(optionName: handleStateOption cfg.icons.${optionName})
);
// (handleBufferOption (getAttrs (attrNames stateOption) stateOption));
in
(handleStateOption (getAttrs (attrNames stateOptions) cfg.icons))
// (genAttrs [
"alternate"
"current"
"inactive"
"visible"
] (optionName: handleStateOption cfg.icons.${optionName}));
inherit (cfg) hide;
insert_at_end = cfg.insertAtEnd;
insert_at_start = cfg.insertAtStart;
@ -320,29 +285,23 @@ in {
inherit (cfg) letters;
no_name_title = cfg.noNameTitle;
sidebar_filetypes = cfg.sidebarFiletypes;
}
// cfg.extraOptions;
} // cfg.extraOptions;
keymaps =
flatten
(
mapAttrsToList
(
optionName: funcName: let
keymaps = flatten (
mapAttrsToList (
optionName: funcName:
let
key = cfg.keymaps.${optionName};
in
optional
(key != null)
{
mode = "n";
inherit key;
action = "<Cmd>Buffer${funcName}<CR>";
options.silent = cfg.keymaps.silent;
}
)
keymapsActions
optional (key != null) {
mode = "n";
inherit key;
action = "<Cmd>Buffer${funcName}<CR>";
options.silent = cfg.keymaps.silent;
}
) keymapsActions
);
in
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
cfg.package

View file

@ -5,61 +5,61 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.barbecue;
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in {
options.plugins.barbecue =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "barbecue-nvim";
in
{
options.plugins.barbecue = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "barbecue-nvim";
package = helpers.mkPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
package = helpers.mkPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
attachNavic = helpers.defaultNullOpts.mkBool true ''
Whether to attach navic to language servers automatically.
attachNavic = helpers.defaultNullOpts.mkBool true ''
Whether to attach navic to language servers automatically.
'';
createAutocmd = helpers.defaultNullOpts.mkBool true ''
Whether to create winbar updater autocmd.
'';
includeBuftypes = mkListStr ''[""]'' ''
Buftypes to enable winbar in.
'';
excludeFiletypes = mkListStr ''["netrw" "toggleterm"]'' ''
Filetypes not to enable winbar in.
'';
modifiers = {
dirname = helpers.defaultNullOpts.mkStr ":~:." ''
Filename modifiers applied to dirname.
See: `:help filename-modifiers`
'';
createAutocmd = helpers.defaultNullOpts.mkBool true ''
Whether to create winbar updater autocmd.
basename = helpers.defaultNullOpts.mkStr "" ''
Filename modifiers applied to basename.
See: `:help filename-modifiers`
'';
};
includeBuftypes = mkListStr ''[""]'' ''
Buftypes to enable winbar in.
'';
showDirname = helpers.defaultNullOpts.mkBool true ''
Whether to display path to file.
'';
excludeFiletypes = mkListStr ''["netrw" "toggleterm"]'' ''
Filetypes not to enable winbar in.
'';
showBasename = helpers.defaultNullOpts.mkBool true ''
Whether to display file name.
'';
modifiers = {
dirname = helpers.defaultNullOpts.mkStr ":~:." ''
Filename modifiers applied to dirname.
showModified = helpers.defaultNullOpts.mkBool false ''
Whether to replace file icon with the modified symbol when buffer is modified.
'';
See: `:help filename-modifiers`
'';
basename = helpers.defaultNullOpts.mkStr "" ''
Filename modifiers applied to basename.
See: `:help filename-modifiers`
'';
};
showDirname = helpers.defaultNullOpts.mkBool true ''
Whether to display path to file.
'';
showBasename = helpers.defaultNullOpts.mkBool true ''
Whether to display file name.
'';
showModified = helpers.defaultNullOpts.mkBool false ''
Whether to replace file icon with the modified symbol when buffer is modified.
'';
modified =
helpers.defaultNullOpts.mkLuaFn
modified =
helpers.defaultNullOpts.mkLuaFn
''
function(bufnr)
return vim.bo[bufnr].modified
@ -70,12 +70,12 @@ in {
NOTE: This can be used to get file modified status from SCM (e.g. git)
'';
showNavic = helpers.defaultNullOpts.mkBool true ''
Whether to show/use navic in the winbar.
'';
showNavic = helpers.defaultNullOpts.mkBool true ''
Whether to show/use navic in the winbar.
'';
leadCustomSection =
helpers.defaultNullOpts.mkLuaFn
leadCustomSection =
helpers.defaultNullOpts.mkLuaFn
''
function()
return " "
@ -86,8 +86,8 @@ in {
NOTE: This function shouldn't do any expensive actions as it is run on each render.
'';
customSection =
helpers.defaultNullOpts.mkLuaFn
customSection =
helpers.defaultNullOpts.mkLuaFn
''
function()
return " "
@ -98,101 +98,88 @@ in {
NOTE: This function shouldn't do any expensive actions as it is run on each render.
'';
theme = helpers.defaultNullOpts.mkStr "auto" ''
Theme to be used for generating highlight groups dynamically.
theme = helpers.defaultNullOpts.mkStr "auto" ''
Theme to be used for generating highlight groups dynamically.
'';
contextFollowIconColor = helpers.defaultNullOpts.mkBool false ''
Whether context text should follow its icon's color.
'';
symbols = {
modified = helpers.defaultNullOpts.mkStr "" ''
Modification indicator.
'';
contextFollowIconColor = helpers.defaultNullOpts.mkBool false ''
Whether context text should follow its icon's color.
ellipsis = helpers.defaultNullOpts.mkStr "" ''
Truncation indicator.
'';
symbols = {
modified = helpers.defaultNullOpts.mkStr "" ''
Modification indicator.
'';
ellipsis = helpers.defaultNullOpts.mkStr "" ''
Truncation indicator.
'';
separator = helpers.defaultNullOpts.mkStr "" ''
Entry separator.
'';
};
kinds =
mapAttrs
(
name: default:
helpers.defaultNullOpts.mkStr default "icon for ${name}."
)
{
File = "";
Module = "";
Namespace = "";
Package = "";
Class = "";
Method = "";
Property = "";
Field = "";
Constructor = "";
Enum = "";
Interface = "";
Function = "";
Variable = "";
Constant = "";
String = "";
Number = "";
Boolean = "";
Array = "";
Object = "";
Key = "";
Null = "";
EnumMember = "";
Struct = "";
Event = "";
Operator = "";
TypeParameter = "";
};
separator = helpers.defaultNullOpts.mkStr "" ''
Entry separator.
'';
};
config = let
setupOptions = with cfg;
{
attach_navic = attachNavic;
create_autocmd = createAutocmd;
include_buftypes = includeBuftypes;
exclude_filetypes = excludeFiletypes;
modifiers = {
inherit
(modifiers)
dirname
basename
;
};
show_dirname = showDirname;
show_basename = showBasename;
show_modified = showModified;
inherit modified;
show_navic = showNavic;
lead_custom_section = leadCustomSection;
custom_section = customSection;
inherit theme;
context_follow_icon_color = contextFollowIconColor;
symbols = {
inherit
(symbols)
modified
ellipsis
separator
;
};
inherit kinds;
}
// cfg.extraOptions;
in
kinds = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
File = "";
Module = "";
Namespace = "";
Package = "";
Class = "";
Method = "";
Property = "";
Field = "";
Constructor = "";
Enum = "";
Interface = "";
Function = "";
Variable = "";
Constant = "";
String = "";
Number = "";
Boolean = "";
Array = "";
Object = "";
Key = "";
Null = "";
EnumMember = "";
Struct = "";
Event = "";
Operator = "";
TypeParameter = "";
};
};
config =
let
setupOptions =
with cfg;
{
attach_navic = attachNavic;
create_autocmd = createAutocmd;
include_buftypes = includeBuftypes;
exclude_filetypes = excludeFiletypes;
modifiers = {
inherit (modifiers) dirname basename;
};
show_dirname = showDirname;
show_basename = showBasename;
show_modified = showModified;
inherit modified;
show_navic = showNavic;
lead_custom_section = leadCustomSection;
custom_section = customSection;
inherit theme;
context_follow_icon_color = contextFollowIconColor;
symbols = {
inherit (symbols) modified ellipsis separator;
};
inherit kinds;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('barbecue').setup(${helpers.toLuaObject setupOptions})

View file

@ -5,7 +5,8 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.bufferline;
highlightOptions = {
@ -88,28 +89,31 @@ with lib; let
trunc_marker = "trunkMarker";
};
in {
in
{
options = {
plugins.bufferline =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "bufferline";
plugins.bufferline = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "bufferline";
package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim;
package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim;
mode = helpers.defaultNullOpts.mkEnumFirstDefault ["buffers" "tabs"] "mode";
mode = helpers.defaultNullOpts.mkEnumFirstDefault [
"buffers"
"tabs"
] "mode";
themable =
helpers.defaultNullOpts.mkBool true
"Whether or not bufferline highlights can be overridden externally";
themable = helpers.defaultNullOpts.mkBool true "Whether or not bufferline highlights can be overridden externally";
numbers =
helpers.defaultNullOpts.mkNullable
numbers =
helpers.defaultNullOpts.mkNullable
(
with types;
either
(enum ["none" "ordinal" "buffer_id" "both"])
helpers.nixvimTypes.rawLua
either (enum [
"none"
"ordinal"
"buffer_id"
"both"
]) helpers.nixvimTypes.rawLua
)
"none"
''
@ -121,166 +125,137 @@ in {
```
'';
bufferCloseIcon = helpers.defaultNullOpts.mkStr "" "The close icon for each buffer.";
bufferCloseIcon = helpers.defaultNullOpts.mkStr "" "The close icon for each buffer.";
modifiedIcon =
helpers.defaultNullOpts.mkStr ""
"The icon indicating a buffer was modified.";
modifiedIcon = helpers.defaultNullOpts.mkStr "" "The icon indicating a buffer was modified.";
closeIcon = helpers.defaultNullOpts.mkStr "" "The close icon.";
closeIcon = helpers.defaultNullOpts.mkStr "" "The close icon.";
closeCommand =
helpers.defaultNullOpts.mkStr "bdelete! %d"
"Command or function run when closing a buffer.";
closeCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when closing a buffer.";
leftMouseCommand =
helpers.defaultNullOpts.mkStr "buffer %d"
"Command or function run when clicking on a buffer.";
leftMouseCommand = helpers.defaultNullOpts.mkStr "buffer %d" "Command or function run when clicking on a buffer.";
rightMouseCommand =
helpers.defaultNullOpts.mkStr "bdelete! %d"
"Command or function run when right clicking on a buffer.";
rightMouseCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when right clicking on a buffer.";
middleMouseCommand =
helpers.defaultNullOpts.mkStr "null"
"Command or function run when middle clicking on a buffer.";
middleMouseCommand = helpers.defaultNullOpts.mkStr "null" "Command or function run when middle clicking on a buffer.";
indicator = {
icon = helpers.defaultNullOpts.mkStr "" "icon";
indicator = {
icon = helpers.defaultNullOpts.mkStr "" "icon";
style = helpers.defaultNullOpts.mkEnumFirstDefault ["icon" "underline"] "style";
};
leftTruncMarker = helpers.defaultNullOpts.mkStr "" "left trunc marker";
rightTruncMarker = helpers.defaultNullOpts.mkStr "" "right trunc marker";
separatorStyle =
helpers.defaultNullOpts.mkEnum ["slant" "padded_slant" "slope" "padded_slope" "thick" "thin"] "thin"
"Separator style";
nameFormatter =
helpers.defaultNullOpts.mkLuaFn "null"
''
A lua function that can be used to modify the buffer's label.
The argument 'buf' containing a name, path and bufnr is supplied.
'';
truncateNames = helpers.defaultNullOpts.mkBool true "Whether to truncate names.";
tabSize = helpers.defaultNullOpts.mkInt 18 "Size of the tabs";
maxNameLength = helpers.defaultNullOpts.mkInt 18 "Max length of a buffer name.";
colorIcons = helpers.defaultNullOpts.mkBool true "Enable color icons.";
showBufferIcons = helpers.defaultNullOpts.mkBool true "Show buffer icons";
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
getElementIcon =
helpers.defaultNullOpts.mkLuaFn "null"
''
Lua function returning an element icon.
```
fun(opts: IconFetcherOpts): string?, string?
```
'';
showCloseIcon = helpers.defaultNullOpts.mkBool true "Whether to show the close icon.";
showTabIndicators =
helpers.defaultNullOpts.mkBool true
"Whether to show the tab indicators.";
showDuplicatePrefix =
helpers.defaultNullOpts.mkBool true
"Whether to show the prefix of duplicated files.";
enforceRegularTabs =
helpers.defaultNullOpts.mkBool false
"Whether to enforce regular tabs.";
alwaysShowBufferline =
helpers.defaultNullOpts.mkBool true
"Whether to always show the bufferline.";
persistBufferSort =
helpers.defaultNullOpts.mkBool true
"Whether to make the buffer sort persistent.";
maxPrefixLength = helpers.defaultNullOpts.mkInt 15 "Maximum prefix length";
sortBy = helpers.defaultNullOpts.mkStr "id" "sort by";
diagnostics =
helpers.defaultNullOpts.mkNullable
(with types; either bool (enum ["nvim_lsp" "coc"])) "false" "diagnostics";
diagnosticsIndicator =
helpers.defaultNullOpts.mkLuaFn "null"
"Either `null` or a function that returns the diagnostics indicator.";
diagnosticsUpdateInInsert =
helpers.defaultNullOpts.mkBool true
"Whether diagnostics should update in insert mode";
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
groups = {
items =
helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]"
"List of groups.";
options = {
toggleHiddenOnEnter =
helpers.defaultNullOpts.mkBool true
"Re-open hidden groups on bufenter.";
};
};
hover = {
enabled = mkEnableOption "hover";
reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal";
delay = helpers.defaultNullOpts.mkInt 200 "delay";
};
debug = {
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
};
customFilter =
helpers.defaultNullOpts.mkLuaFn "null"
''
```
fun(buf: number, bufnums: number[]): boolean
```
'';
highlights =
genAttrs
(attrValues highlightOptions)
(
name:
helpers.mkNullOrOption helpers.nixvimTypes.highlight ''
Highlight group definition for ${name}.
''
);
style = helpers.defaultNullOpts.mkEnumFirstDefault [
"icon"
"underline"
] "style";
};
leftTruncMarker = helpers.defaultNullOpts.mkStr "" "left trunc marker";
rightTruncMarker = helpers.defaultNullOpts.mkStr "" "right trunc marker";
separatorStyle = helpers.defaultNullOpts.mkEnum [
"slant"
"padded_slant"
"slope"
"padded_slope"
"thick"
"thin"
] "thin" "Separator style";
nameFormatter = helpers.defaultNullOpts.mkLuaFn "null" ''
A lua function that can be used to modify the buffer's label.
The argument 'buf' containing a name, path and bufnr is supplied.
'';
truncateNames = helpers.defaultNullOpts.mkBool true "Whether to truncate names.";
tabSize = helpers.defaultNullOpts.mkInt 18 "Size of the tabs";
maxNameLength = helpers.defaultNullOpts.mkInt 18 "Max length of a buffer name.";
colorIcons = helpers.defaultNullOpts.mkBool true "Enable color icons.";
showBufferIcons = helpers.defaultNullOpts.mkBool true "Show buffer icons";
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
getElementIcon = helpers.defaultNullOpts.mkLuaFn "null" ''
Lua function returning an element icon.
```
fun(opts: IconFetcherOpts): string?, string?
```
'';
showCloseIcon = helpers.defaultNullOpts.mkBool true "Whether to show the close icon.";
showTabIndicators = helpers.defaultNullOpts.mkBool true "Whether to show the tab indicators.";
showDuplicatePrefix = helpers.defaultNullOpts.mkBool true "Whether to show the prefix of duplicated files.";
enforceRegularTabs = helpers.defaultNullOpts.mkBool false "Whether to enforce regular tabs.";
alwaysShowBufferline = helpers.defaultNullOpts.mkBool true "Whether to always show the bufferline.";
persistBufferSort = helpers.defaultNullOpts.mkBool true "Whether to make the buffer sort persistent.";
maxPrefixLength = helpers.defaultNullOpts.mkInt 15 "Maximum prefix length";
sortBy = helpers.defaultNullOpts.mkStr "id" "sort by";
diagnostics = helpers.defaultNullOpts.mkNullable (
with types;
either bool (enum [
"nvim_lsp"
"coc"
])
) "false" "diagnostics";
diagnosticsIndicator = helpers.defaultNullOpts.mkLuaFn "null" "Either `null` or a function that returns the diagnostics indicator.";
diagnosticsUpdateInInsert = helpers.defaultNullOpts.mkBool true "Whether diagnostics should update in insert mode";
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
groups = {
items = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" "List of groups.";
options = {
toggleHiddenOnEnter = helpers.defaultNullOpts.mkBool true "Re-open hidden groups on bufenter.";
};
};
hover = {
enabled = mkEnableOption "hover";
reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal";
delay = helpers.defaultNullOpts.mkInt 200 "delay";
};
debug = {
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
};
customFilter = helpers.defaultNullOpts.mkLuaFn "null" ''
```
fun(buf: number, bufnums: number[]): boolean
```
'';
highlights = genAttrs (attrValues highlightOptions) (
name:
helpers.mkNullOrOption helpers.nixvimTypes.highlight ''
Highlight group definition for ${name}.
''
);
};
};
config = let
setupOptions = with cfg; {
options =
{
inherit
mode
themable
numbers
;
config =
let
setupOptions = with cfg; {
options = {
inherit mode themable numbers;
buffer_close_icon = bufferCloseIcon;
modified_icon = modifiedIcon;
close_icon = closeIcon;
@ -319,29 +294,19 @@ in {
};
};
hover = {
inherit
(hover)
enabled
reveal
delay
;
inherit (hover) enabled reveal delay;
};
debug = {
inherit (debug) logging;
};
custom_filter = customFilter;
}
// cfg.extraOptions;
} // cfg.extraOptions;
highlights =
mapAttrs
(
pluginOptionName: nixvimOptionName:
cfg.highlights.${nixvimOptionName}
)
highlightOptions;
};
in
highlights = mapAttrs (
pluginOptionName: nixvimOptionName: cfg.highlights.${nixvimOptionName}
) highlightOptions;
};
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
cfg.package

View file

@ -5,113 +5,109 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.navic;
in {
options.plugins.navic =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "nvim-navic";
in
{
options.plugins.navic = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-navic";
package = helpers.mkPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
package = helpers.mkPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
icons =
mapAttrs
(
name: default:
helpers.defaultNullOpts.mkStr default "icon for ${name}."
)
{
File = "󰈙 ";
Module = " ";
Namespace = "󰌗 ";
Package = " ";
Class = "󰌗 ";
Method = "󰆧 ";
Property = " ";
Field = " ";
Constructor = " ";
Enum = "󰕘";
Interface = "󰕘";
Function = "󰊕 ";
Variable = "󰆧 ";
Constant = "󰏿 ";
String = "󰀬 ";
Number = "󰎠 ";
Boolean = " ";
Array = "󰅪 ";
Object = "󰅩 ";
Key = "󰌋 ";
Null = "󰟢 ";
EnumMember = " ";
Struct = "󰌗 ";
Event = " ";
Operator = "󰆕 ";
TypeParameter = "󰊄 ";
};
icons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
File = "󰈙 ";
Module = " ";
Namespace = "󰌗 ";
Package = " ";
Class = "󰌗 ";
Method = "󰆧 ";
Property = " ";
Field = " ";
Constructor = " ";
Enum = "󰕘";
Interface = "󰕘";
Function = "󰊕 ";
Variable = "󰆧 ";
Constant = "󰏿 ";
String = "󰀬 ";
Number = "󰎠 ";
Boolean = " ";
Array = "󰅪 ";
Object = "󰅩 ";
Key = "󰌋 ";
Null = "󰟢 ";
EnumMember = " ";
Struct = "󰌗 ";
Event = " ";
Operator = "󰆕 ";
TypeParameter = "󰊄 ";
};
lsp = {
autoAttach = helpers.defaultNullOpts.mkBool false ''
Enable to have nvim-navic automatically attach to every LSP for current buffer. Its disabled by default.
'';
preference = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
Table ranking lsp_servers. Lower the index, higher the priority of the server. If there are more than one server attached to a buffer. In the example below will prefer clangd over pyright
Example: `[ "clangd" "pyright" ]`.
'';
};
highlight = helpers.defaultNullOpts.mkBool false ''
If set to true, will add colors to icons and text as defined by highlight groups NavicIcons* (NavicIconsFile, NavicIconsModule.. etc.), NavicText and NavicSeparator.
lsp = {
autoAttach = helpers.defaultNullOpts.mkBool false ''
Enable to have nvim-navic automatically attach to every LSP for current buffer. Its disabled by default.
'';
separator = helpers.defaultNullOpts.mkStr " > " ''
Icon to separate items. to use between items.
'';
preference = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
Table ranking lsp_servers. Lower the index, higher the priority of the server. If there are more than one server attached to a buffer. In the example below will prefer clangd over pyright
depthLimit = helpers.defaultNullOpts.mkInt 0 ''
Maximum depth of context to be shown. If the context hits this depth limit, it is truncated.
'';
depthLimitIndicator = helpers.defaultNullOpts.mkStr ".." ''
Icon to indicate that depth_limit was hit and the shown context is truncated.
'';
safeOutput = helpers.defaultNullOpts.mkBool true ''
Sanitize the output for use in statusline and winbar.
'';
lazyUpdateContext = helpers.defaultNullOpts.mkBool false ''
If true, turns off context updates for the "CursorMoved" event.
'';
click = helpers.defaultNullOpts.mkBool false ''
Single click to goto element, double click to open nvim-navbuddy on the clicked element.
Example: `[ "clangd" "pyright" ]`.
'';
};
config = let
setupOptions = with cfg;
{
inherit
icons
highlight
separator
click
;
lsp = with lsp; {
auto_attach = autoAttach;
inherit preference;
};
depth_limit = depthLimit;
safe_output = safeOutput;
lazy_update_context = lazyUpdateContext;
}
// cfg.extraOptions;
in
highlight = helpers.defaultNullOpts.mkBool false ''
If set to true, will add colors to icons and text as defined by highlight groups NavicIcons* (NavicIconsFile, NavicIconsModule.. etc.), NavicText and NavicSeparator.
'';
separator = helpers.defaultNullOpts.mkStr " > " ''
Icon to separate items. to use between items.
'';
depthLimit = helpers.defaultNullOpts.mkInt 0 ''
Maximum depth of context to be shown. If the context hits this depth limit, it is truncated.
'';
depthLimitIndicator = helpers.defaultNullOpts.mkStr ".." ''
Icon to indicate that depth_limit was hit and the shown context is truncated.
'';
safeOutput = helpers.defaultNullOpts.mkBool true ''
Sanitize the output for use in statusline and winbar.
'';
lazyUpdateContext = helpers.defaultNullOpts.mkBool false ''
If true, turns off context updates for the "CursorMoved" event.
'';
click = helpers.defaultNullOpts.mkBool false ''
Single click to goto element, double click to open nvim-navbuddy on the clicked element.
'';
};
config =
let
setupOptions =
with cfg;
{
inherit
icons
highlight
separator
click
;
lsp = with lsp; {
auto_attach = autoAttach;
inherit preference;
};
depth_limit = depthLimit;
safe_output = safeOutput;
lazy_update_context = lazyUpdateContext;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('nvim-navic').setup(${helpers.toLuaObject setupOptions})

View file

@ -6,48 +6,44 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ayu";
isColorscheme = true;
originalName = "neovim-ayu";
defaultPackage = pkgs.vimPlugins.neovim-ayu;
# The colorscheme option is set by the `setup` function.
colorscheme = null;
callSetup = false;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ayu";
isColorscheme = true;
originalName = "neovim-ayu";
defaultPackage = pkgs.vimPlugins.neovim-ayu;
# The colorscheme option is set by the `setup` function.
colorscheme = null;
callSetup = false;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"mirage"
"overrides"
];
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"mirage"
"overrides"
];
settingsOptions = {
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
settingsOptions = {
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
overrides =
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
overrides = helpers.defaultNullOpts.mkStrLuaOr (with helpers.nixvimTypes; attrsOf highlight) "{}" ''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};
extraConfig = cfg: {
extraConfigLuaPre = ''
local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject cfg.settings})
ayu.colorscheme()
'';
};
}
extraConfig = cfg: {
extraConfigLuaPre = ''
local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject cfg.settings})
ayu.colorscheme()
'';
};
}

View file

@ -8,111 +8,123 @@
with lib;
# We configure this plugin manually (no `settings` option) so there is no point in using
# `mkNeovimPlugin` here.
helpers.vim-plugin.mkVimPlugin config {
name = "base16";
isColorscheme = true;
originalName = "base16.nvim";
defaultPackage = pkgs.vimPlugins.base16-nvim;
helpers.vim-plugin.mkVimPlugin config {
name = "base16";
isColorscheme = true;
originalName = "base16.nvim";
defaultPackage = pkgs.vimPlugins.base16-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# We manually set the colorscheme if needed.
colorscheme = null;
# We manually set the colorscheme if needed.
colorscheme = null;
# TODO introduced 2024-03-12: remove 2024-05-12
imports = let
basePluginPath = ["colorschemes" "base16"];
in [
(
mkRenamedOptionModule
(basePluginPath ++ ["customColorScheme"])
(basePluginPath ++ ["colorscheme"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["useTruecolor"])
["options" "termguicolors"]
)
# TODO introduced 2024-03-12: remove 2024-05-12
imports =
let
basePluginPath = [
"colorschemes"
"base16"
];
in
[
(mkRenamedOptionModule (basePluginPath ++ [ "customColorScheme" ]) (
basePluginPath ++ [ "colorscheme" ]
))
(mkRenamedOptionModule (basePluginPath ++ [ "useTruecolor" ]) [
"options"
"termguicolors"
])
];
extraOptions = {
colorscheme = let
extraOptions = {
colorscheme =
let
customColorschemeType = types.submodule {
options =
listToAttrs
(
map
(
colorId: rec {
name = "base0" + colorId;
value = mkOption {
type = types.str;
description = "The value for color `${name}`.";
example = "#16161D";
};
}
)
["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"]
);
options = listToAttrs (
map
(colorId: rec {
name = "base0" + colorId;
value = mkOption {
type = types.str;
description = "The value for color `${name}`.";
example = "#16161D";
};
})
[
"0"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"A"
"B"
"C"
"D"
"E"
"F"
]
);
};
in
mkOption {
type = with types;
either
(enum (import ./theme-list.nix))
customColorschemeType;
description = ''
The base16 colorscheme to use.
It can either be the name of a builtin colorscheme or an attrs specifying each color explicitly.
mkOption {
type = with types; either (enum (import ./theme-list.nix)) customColorschemeType;
description = ''
The base16 colorscheme to use.
It can either be the name of a builtin colorscheme or an attrs specifying each color explicitly.
Example for the latter:
```nix
{
base00 = "#16161D";
base01 = "#2c313c";
base02 = "#3e4451";
base03 = "#6c7891";
base04 = "#565c64";
base05 = "#abb2bf";
base06 = "#9a9bb3";
base07 = "#c5c8e6";
base08 = "#e06c75";
base09 = "#d19a66";
base0A = "#e5c07b";
base0B = "#98c379";
base0C = "#56b6c2";
base0D = "#0184bc";
base0E = "#c678dd";
base0F = "#a06949";
}
```
'';
example = "edge-light";
};
setUpBar = mkOption {
type = types.bool;
default = true;
description = "Whether to set your status bar theme to 'base16'.";
Example for the latter:
```nix
{
base00 = "#16161D";
base01 = "#2c313c";
base02 = "#3e4451";
base03 = "#6c7891";
base04 = "#565c64";
base05 = "#abb2bf";
base06 = "#9a9bb3";
base07 = "#c5c8e6";
base08 = "#e06c75";
base09 = "#d19a66";
base0A = "#e5c07b";
base0B = "#98c379";
base0C = "#56b6c2";
base0D = "#0184bc";
base0E = "#c678dd";
base0F = "#a06949";
}
```
'';
example = "edge-light";
};
setUpBar = mkOption {
type = types.bool;
default = true;
description = "Whether to set your status bar theme to 'base16'.";
};
};
extraConfig = cfg:
mkMerge [
{
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
plugins.lualine.theme = mkIf cfg.setUpBar "base16";
plugins.lightline.colorscheme = null;
extraConfig =
cfg:
mkMerge [
{
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
plugins.lualine.theme = mkIf cfg.setUpBar "base16";
plugins.lightline.colorscheme = null;
opts.termguicolors = mkDefault true;
}
(mkIf (isString cfg.colorscheme) {
colorscheme = "base16-${cfg.colorscheme}";
})
(mkIf (isAttrs cfg.colorscheme) {
extraConfigLuaPre = ''
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
'';
})
];
}
opts.termguicolors = mkDefault true;
}
(mkIf (isString cfg.colorscheme) { colorscheme = "base16-${cfg.colorscheme}"; })
(mkIf (isAttrs cfg.colorscheme) {
extraConfigLuaPre = ''
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
'';
})
];
}

View file

@ -6,44 +6,105 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "catppuccin";
isColorscheme = true;
defaultPackage = pkgs.vimPlugins.catppuccin-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "catppuccin";
isColorscheme = true;
defaultPackage = pkgs.vimPlugins.catppuccin-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-27: remove 2024-05-27
optionsRenamedToSettings = [
"flavour"
["background" "light"]
["background" "dark"]
"transparentBackground"
["dimInactive" "enabled"]
["dimInactive" "shade"]
["dimInactive" "percentage"]
["styles" "comments"]
["styles" "conditionals"]
["styles" "loops"]
["styles" "functions"]
["styles" "keywords"]
["styles" "strings"]
["styles" "variables"]
["styles" "numbers"]
["styles" "booleans"]
["styles" "properties"]
["styles" "types"]
["styles" "operators"]
"colorOverrides"
"customHighlights"
"integrations"
];
imports =
mapAttrsToList (
# TODO introduced 2024-03-27: remove 2024-05-27
optionsRenamedToSettings = [
"flavour"
[
"background"
"light"
]
[
"background"
"dark"
]
"transparentBackground"
[
"dimInactive"
"enabled"
]
[
"dimInactive"
"shade"
]
[
"dimInactive"
"percentage"
]
[
"styles"
"comments"
]
[
"styles"
"conditionals"
]
[
"styles"
"loops"
]
[
"styles"
"functions"
]
[
"styles"
"keywords"
]
[
"styles"
"strings"
]
[
"styles"
"variables"
]
[
"styles"
"numbers"
]
[
"styles"
"booleans"
]
[
"styles"
"properties"
]
[
"styles"
"types"
]
[
"styles"
"operators"
]
"colorOverrides"
"customHighlights"
"integrations"
];
imports =
mapAttrsToList
(
old: new:
mkRenamedOptionModule
["colorschemes" "catppuccin" old]
["colorschemes" "catppuccin" "settings" new]
mkRenamedOptionModule
[
"colorschemes"
"catppuccin"
old
]
[
"colorschemes"
"catppuccin"
"settings"
new
]
)
{
showBufferEnd = "show_end_of_buffer";
@ -53,33 +114,35 @@ with lib;
disableUnderline = "no_underline";
};
settingsOptions = let
settingsOptions =
let
flavours = [
"latte"
"mocha"
"frappe"
"macchiato"
];
in {
compile_path =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath 'cache' .. '/catppuccin'";}''
"Set the compile cache directory.";
in
{
compile_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath 'cache' .. '/catppuccin'";}'' "Set the compile cache directory.";
flavour = helpers.mkNullOrOption (types.enum (flavours ++ ["auto"])) ''
flavour = helpers.mkNullOrOption (types.enum (flavours ++ [ "auto" ])) ''
Theme flavour.
'';
background = let
mkBackgroundStyle = name:
helpers.defaultNullOpts.mkEnumFirstDefault flavours ''
Background for `${name}` background.
'';
in {
light = mkBackgroundStyle "light";
background =
let
mkBackgroundStyle =
name:
helpers.defaultNullOpts.mkEnumFirstDefault flavours ''
Background for `${name}` background.
'';
in
{
light = mkBackgroundStyle "light";
dark = mkBackgroundStyle "dark";
};
dark = mkBackgroundStyle "dark";
};
transparent_background = helpers.defaultNullOpts.mkBool false ''
Enable Transparent background.
@ -169,19 +232,15 @@ with lib;
'';
};
color_overrides =
genAttrs
(flavours ++ ["all"])
(
flavour:
helpers.defaultNullOpts.mkAttrsOf types.str
"{}"
(
if flavour == "all"
then "Override colors for all the flavours."
else "Override colors for the ${flavour} flavour."
)
);
color_overrides = genAttrs (flavours ++ [ "all" ]) (
flavour:
helpers.defaultNullOpts.mkAttrsOf types.str "{}" (
if flavour == "all" then
"Override colors for all the flavours."
else
"Override colors for the ${flavour} flavour."
)
);
custom_highlights = helpers.mkNullOrStrLuaFnOr (with types; attrsOf anything) ''
Override specific highlight groups to use other groups or a hex color.
@ -230,29 +289,30 @@ with lib;
'';
};
settingsExample = {
flavour = "mocha";
disable_underline = true;
term_colors = true;
color_overrides.mocha.base = "#1e1e2f";
styles = {
booleans = ["bold" "italic"];
conditionals = ["bold"];
};
integrations = {
cmp = true;
gitsigns = true;
nvimtree = true;
treesitter = true;
notify = false;
mini = {
enabled = true;
indentscope_color = "";
};
settingsExample = {
flavour = "mocha";
disable_underline = true;
term_colors = true;
color_overrides.mocha.base = "#1e1e2f";
styles = {
booleans = [
"bold"
"italic"
];
conditionals = [ "bold" ];
};
integrations = {
cmp = true;
gitsigns = true;
nvimtree = true;
treesitter = true;
notify = false;
mini = {
enabled = true;
indentscope_color = "";
};
};
};
extraConfig = cfg: {
opts.termguicolors = mkDefault true;
};
}
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
}

View file

@ -6,83 +6,83 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "cyberdream";
isColorscheme = true;
originalName = "cyberdream.nvim";
defaultPackage = pkgs.vimPlugins.cyberdream-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "cyberdream";
isColorscheme = true;
originalName = "cyberdream.nvim";
defaultPackage = pkgs.vimPlugins.cyberdream-nvim;
maintainers = [helpers.maintainers.AndresBermeoMarinelli];
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
settingsOptions = {
transparent = helpers.defaultNullOpts.mkBool false ''
Enable transparent background.
'';
settingsOptions = {
transparent = helpers.defaultNullOpts.mkBool false ''
Enable transparent background.
'';
italic_comments = helpers.defaultNullOpts.mkBool false ''
Enable italics comments.
'';
italic_comments = helpers.defaultNullOpts.mkBool false ''
Enable italics comments.
'';
hide_fillchars = helpers.defaultNullOpts.mkBool false ''
Replace all fillchars with ' ' for the ultimate clean look.
'';
hide_fillchars = helpers.defaultNullOpts.mkBool false ''
Replace all fillchars with ' ' for the ultimate clean look.
'';
borderless_telescope = helpers.defaultNullOpts.mkBool true ''
Modern borderless telescope theme.
'';
borderless_telescope = helpers.defaultNullOpts.mkBool true ''
Modern borderless telescope theme.
'';
terminal_colors = helpers.defaultNullOpts.mkBool true ''
Set terminal colors used in `:terminal`.
'';
terminal_colors = helpers.defaultNullOpts.mkBool true ''
Set terminal colors used in `:terminal`.
'';
theme = {
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
Highlight groups to override, adding new groups is also possible.
See `:h highlight-groups` for a list of highlight groups.
theme = {
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
Highlight groups to override, adding new groups is also possible.
See `:h highlight-groups` for a list of highlight groups.
Example:
Example:
```nix
{
Comment = {
fg = "#696969";
bg = "NONE";
italic = true;
};
}
```
Complete list can be found in `lua/cyberdream/theme.lua` in upstream repository.
'';
colors = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Override the default colors used.
For a full list of colors, see upstream documentation.
'';
};
};
settingsExample = {
transparent = true;
italic_comments = true;
hide_fillchars = true;
borderless_telescope = true;
terminal_colors = true;
theme = {
highlights = {
```nix
{
Comment = {
fg = "#696969";
bg = "NONE";
italic = true;
};
};
colors = {
bg = "#000000";
green = "#00ff00";
magenta = "#ff00ff";
}
```
Complete list can be found in `lua/cyberdream/theme.lua` in upstream repository.
'';
colors = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Override the default colors used.
For a full list of colors, see upstream documentation.
'';
};
};
settingsExample = {
transparent = true;
italic_comments = true;
hide_fillchars = true;
borderless_telescope = true;
terminal_colors = true;
theme = {
highlights = {
Comment = {
fg = "#696969";
bg = "NONE";
italic = true;
};
};
colors = {
bg = "#000000";
green = "#00ff00";
magenta = "#ff00ff";
};
};
}
};
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.colorschemes.dracula;
in {
in
{
options = {
colorschemes.dracula = {
enable = mkEnableOption "dracula";
@ -63,7 +65,7 @@ in {
config = mkIf cfg.enable {
colorscheme = "dracula";
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals = {
dracula_bold = mkIf (!cfg.bold) 0;

View file

@ -11,41 +11,43 @@ helpers.neovim-plugin.mkNeovimPlugin config {
originalName = "gruvbox.nvim";
defaultPackage = pkgs.vimPlugins.gruvbox-nvim;
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
# Introduced January 31 2024
# TODO remove in early March 2024.
imports =
map
(
optionName:
lib.mkRemovedOptionModule
["colorschemes" "gruvbox" optionName]
"Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
)
[
"italics"
"bold"
"underline"
"undercurl"
"contrastDark"
"contrastLight"
"highlightSearchCursor"
"numberColumn"
"signColumn"
"colorColumn"
"vertSplitColor"
"italicizeComments"
"italicizeStrings"
"invertSelection"
"invertSigns"
"invertIndentGuides"
"invertTabline"
"improvedStrings"
"improvedWarnings"
"transparentBg"
"trueColor"
];
(
optionName:
lib.mkRemovedOptionModule [
"colorschemes"
"gruvbox"
optionName
] "Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
)
[
"italics"
"bold"
"underline"
"undercurl"
"contrastDark"
"contrastLight"
"highlightSearchCursor"
"numberColumn"
"signColumn"
"colorColumn"
"vertSplitColor"
"italicizeComments"
"italicizeStrings"
"invertSelection"
"invertSigns"
"invertIndentGuides"
"invertTabline"
"improvedStrings"
"improvedWarnings"
"transparentBg"
"trueColor"
];
settingsExample = {
terminal_colors = true;

View file

@ -6,110 +6,121 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "kanagawa";
isColorscheme = true;
originalName = "kanagawa.nvim";
defaultPackage = pkgs.vimPlugins.kanagawa-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "kanagawa";
isColorscheme = true;
originalName = "kanagawa.nvim";
defaultPackage = pkgs.vimPlugins.kanagawa-nvim;
description = ''
You can select the theme in two ways:
- Set `colorschemes.kanagawa.settings.theme` AND explicitly unset `vim.o.background` (i.e. `options.background = ""`).
- Set `colorschemes.kanagawa.settings.background` (the active theme will depend on the value of `vim.o.background`).
description = ''
You can select the theme in two ways:
- Set `colorschemes.kanagawa.settings.theme` AND explicitly unset `vim.o.background` (i.e. `options.background = ""`).
- Set `colorschemes.kanagawa.settings.background` (the active theme will depend on the value of `vim.o.background`).
'';
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-15: remove 2024-05-15
deprecateExtraOptions = true;
imports =
let
basePluginPath = [
"colorschemes"
"kanagawa"
];
in
(map
(
optionPath:
mkRenamedOptionModule (basePluginPath ++ optionPath) (
basePluginPath ++ [ "settings" ] ++ optionPath
)
)
[
[ "compile" ]
[ "undercurl" ]
[ "commentStyle" ]
[ "functionStyle" ]
[ "keywordStyle" ]
[ "statementStyle" ]
[ "typeStyle" ]
[ "transparent" ]
[ "dimInactive" ]
[ "terminalColors" ]
[
"colors"
"palette"
]
[
"colors"
"theme"
]
[ "theme" ]
[
"background"
"dark"
]
[
"background"
"light"
]
]
)
++ [
(mkRemovedOptionModule (basePluginPath ++ [ "overrides" ]) ''
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
```
function(colors)
...
end
```
'')
];
settingsOptions = {
compile = helpers.defaultNullOpts.mkBool false ''
Enable compiling the colorscheme.
'';
maintainers = [maintainers.GaetanLepage];
undercurl = helpers.defaultNullOpts.mkBool true ''
Enable undercurls.
'';
# TODO introduced 2024-03-15: remove 2024-05-15
deprecateExtraOptions = true;
imports = let
basePluginPath = ["colorschemes" "kanagawa"];
in
(
map
(
optionPath:
mkRenamedOptionModule
(basePluginPath ++ optionPath)
(basePluginPath ++ ["settings"] ++ optionPath)
)
[
["compile"]
["undercurl"]
["commentStyle"]
["functionStyle"]
["keywordStyle"]
["statementStyle"]
["typeStyle"]
["transparent"]
["dimInactive"]
["terminalColors"]
["colors" "palette"]
["colors" "theme"]
["theme"]
["background" "dark"]
["background" "light"]
]
)
++ [
(
mkRemovedOptionModule
(basePluginPath ++ ["overrides"])
''
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
```
function(colors)
...
end
```
''
)
];
commentStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
Highlight options for comments.
'';
settingsOptions = {
compile = helpers.defaultNullOpts.mkBool false ''
Enable compiling the colorscheme.
'';
functionStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
Highlight options for functions.
'';
undercurl = helpers.defaultNullOpts.mkBool true ''
Enable undercurls.
'';
keywordStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
Highlight options for keywords.
'';
commentStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
Highlight options for comments.
'';
statementStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{bold = true;}" ''
Highlight options for statements.
'';
functionStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
Highlight options for functions.
'';
typeStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
Highlight options for types.
'';
keywordStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
Highlight options for keywords.
'';
transparent = helpers.defaultNullOpts.mkBool false ''
Whether to set a background color.
'';
statementStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{bold = true;}" ''
Highlight options for statements.
'';
dimInactive = helpers.defaultNullOpts.mkBool false ''
Whether dim inactive window `:h hl-NormalNC`.
'';
typeStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
Highlight options for types.
'';
terminalColors = helpers.defaultNullOpts.mkBool true ''
If true, defines `vim.g.terminal_color_{0,17}`.
'';
transparent = helpers.defaultNullOpts.mkBool false ''
Whether to set a background color.
'';
dimInactive = helpers.defaultNullOpts.mkBool false ''
Whether dim inactive window `:h hl-NormalNC`.
'';
terminalColors = helpers.defaultNullOpts.mkBool true ''
If true, defines `vim.g.terminal_color_{0,17}`.
'';
colors = {
theme =
helpers.defaultNullOpts.mkAttrsOf types.attrs
colors = {
theme =
helpers.defaultNullOpts.mkAttrsOf types.attrs
''
{
wave = {};
@ -145,21 +156,21 @@ with lib;
```
'';
palette = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Change all usages of these colors.
palette = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Change all usages of these colors.
Example:
```nix
{
sumiInk0 = "#000000";
fujiWhite = "#FFFFFF";
}
```
'';
};
Example:
```nix
{
sumiInk0 = "#000000";
fujiWhite = "#FFFFFF";
}
```
'';
};
overrides =
helpers.defaultNullOpts.mkLuaFn
overrides =
helpers.defaultNullOpts.mkLuaFn
''
function(colors)
return {}
@ -189,41 +200,41 @@ with lib;
```
'';
theme = helpers.defaultNullOpts.mkStr "wave" ''
The theme to load when background is not set.
theme = helpers.defaultNullOpts.mkStr "wave" ''
The theme to load when background is not set.
'';
background = {
light = helpers.defaultNullOpts.mkStr "lotus" ''
The theme to use when `vim.o.background = "light"`.
'';
background = {
light = helpers.defaultNullOpts.mkStr "lotus" ''
The theme to use when `vim.o.background = "light"`.
'';
dark = helpers.defaultNullOpts.mkStr "wave" ''
The theme to use when `vim.o.background = "dark"`.
'';
};
};
dark = helpers.defaultNullOpts.mkStr "wave" ''
The theme to use when `vim.o.background = "dark"`.
'';
settingsExample = {
compile = false;
undercurl = true;
commentStyle.italic = true;
functionStyle = { };
transparent = false;
dimInactive = false;
terminalColors = true;
colors = {
theme = {
wave.ui.float.bg = "none";
dragon.syn.parameter = "yellow";
all.ui.bg_gutter = "none";
};
palette = {
sumiInk0 = "#000000";
fujiWhite = "#FFFFFF";
};
};
settingsExample = {
compile = false;
undercurl = true;
commentStyle.italic = true;
functionStyle = {};
transparent = false;
dimInactive = false;
terminalColors = true;
colors = {
theme = {
wave.ui.float.bg = "none";
dragon.syn.parameter = "yellow";
all.ui.bg_gutter = "none";
};
palette = {
sumiInk0 = "#000000";
fujiWhite = "#FFFFFF";
};
};
overrides = "function(colors) return {} end";
theme = "wave";
};
}
overrides = "function(colors) return {} end";
theme = "wave";
};
}

View file

@ -6,15 +6,13 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "melange";
isColorscheme = true;
originalName = "melange-nvim";
defaultPackage = pkgs.vimPlugins.melange-nvim;
helpers.vim-plugin.mkVimPlugin config {
name = "melange";
isColorscheme = true;
originalName = "melange-nvim";
defaultPackage = pkgs.vimPlugins.melange-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraConfig = cfg: {
opts.termguicolors = mkDefault true;
};
}
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
}

View file

@ -12,7 +12,7 @@ helpers.vim-plugin.mkVimPlugin config {
defaultPackage = pkgs.vimPlugins.nord-nvim;
globalPrefix = "nord_";
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;

View file

@ -12,7 +12,7 @@ helpers.vim-plugin.mkVimPlugin config {
defaultPackage = pkgs.vimPlugins.vim-one;
globalPrefix = "one_";
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
settingsOptions = {
allow_italics = helpers.defaultNullOpts.mkBool false ''
@ -24,7 +24,5 @@ helpers.vim-plugin.mkVimPlugin config {
allow_italics = true;
};
extraConfig = cfg: {
opts.termguicolors = lib.mkDefault true;
};
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; };
}

View file

@ -11,7 +11,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
originalName = "onedark.nvim";
defaultPackage = pkgs.vimPlugins.onedark-nvim;
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
settingsExample = {
colors = {

View file

@ -11,9 +11,7 @@ helpers.vim-plugin.mkVimPlugin config {
originalName = "oxocarbon.nvim";
defaultPackage = pkgs.vimPlugins.oxocarbon-nvim;
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = cfg: {
opts.termguicolors = lib.mkDefault true;
};
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; };
}

View file

@ -6,70 +6,67 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "palette";
isColorscheme = true;
originalName = "palette.nvim";
defaultPackage = pkgs.vimPlugins.palette-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "palette";
isColorscheme = true;
originalName = "palette.nvim";
defaultPackage = pkgs.vimPlugins.palette-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraPlugins = [
# Annoyingly, lspconfig is required, otherwise this line is breaking:
# https://github.com/roobert/palette.nvim/blob/a808c190a4f74f73782302152ebf323660d8db5f/lua/palette/init.lua#L45
# An issue has been opened upstream to warn the maintainer: https://github.com/roobert/palette.nvim/issues/2
pkgs.vimPlugins.nvim-lspconfig
];
extraPlugins = [
# Annoyingly, lspconfig is required, otherwise this line is breaking:
# https://github.com/roobert/palette.nvim/blob/a808c190a4f74f73782302152ebf323660d8db5f/lua/palette/init.lua#L45
# An issue has been opened upstream to warn the maintainer: https://github.com/roobert/palette.nvim/issues/2
pkgs.vimPlugins.nvim-lspconfig
];
# TODO introduced 2024-04-07: remove 2024-06-07
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"palettes"
"customPalettes"
"italics"
"transparentBackground"
"caching"
"cacheDir"
];
# TODO introduced 2024-04-07: remove 2024-06-07
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"palettes"
"customPalettes"
"italics"
"transparentBackground"
"caching"
"cacheDir"
];
settingsOptions = {
palettes = {
main = helpers.defaultNullOpts.mkStr "dark" ''
Palette for the main colors.
'';
settingsOptions = {
palettes = {
main = helpers.defaultNullOpts.mkStr "dark" ''
Palette for the main colors.
'';
accent = helpers.defaultNullOpts.mkStr "pastel" ''
Palette for the accent colors.
'';
accent = helpers.defaultNullOpts.mkStr "pastel" ''
Palette for the accent colors.
'';
state = helpers.defaultNullOpts.mkStr "pastel" ''
Palette for the state colors.
'';
};
state = helpers.defaultNullOpts.mkStr "pastel" ''
Palette for the state colors.
'';
};
customPalettes =
mapAttrs
customPalettes =
mapAttrs
(
name: colorNames:
helpers.defaultNullOpts.mkAttrsOf (
types.submodule {
options =
genAttrs
colorNames
(
colorName:
mkOption {
type = types.str;
description = "Definition of color '${colorName}'";
}
);
}
)
helpers.defaultNullOpts.mkAttrsOf
(types.submodule {
options = genAttrs colorNames (
colorName:
mkOption {
type = types.str;
description = "Definition of color '${colorName}'";
}
);
})
"{}"
''
Custom palettes for ${name} colors.
''
) {
)
{
main = [
"color0"
"color1"
@ -101,35 +98,35 @@ with lib;
];
};
italics = helpers.defaultNullOpts.mkBool true ''
Whether to use italics.
'';
italics = helpers.defaultNullOpts.mkBool true ''
Whether to use italics.
'';
transparent_background = helpers.defaultNullOpts.mkBool false ''
Whether to use transparent background.
'';
transparent_background = helpers.defaultNullOpts.mkBool false ''
Whether to use transparent background.
'';
caching = helpers.defaultNullOpts.mkBool true ''
Whether to enable caching.
'';
caching = helpers.defaultNullOpts.mkBool true ''
Whether to enable caching.
'';
cache_dir =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath('cache') .. '/palette'";}''
"Cache directory.";
};
cache_dir = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/palette'";}'' "Cache directory.";
};
settingsExample = {};
settingsExample = { };
extraConfig = cfg: {
assertions =
mapAttrsToList (
name: defaultPaletteNames: let
extraConfig = cfg: {
assertions =
mapAttrsToList
(
name: defaultPaletteNames:
let
customPalettesNames = attrNames cfg.settings.custom_palettes.${name};
allowedPaletteNames = customPalettesNames ++ defaultPaletteNames;
palette = cfg.settings.palettes.${name};
in {
in
{
assertion = isString palette -> elem palette allowedPaletteNames;
message = ''
Nixvim (colorschemes.palette): `settings.palettes.${name}` (${palette}") is not part of the allowed ${name} palette names (${concatStringsSep " " allowedPaletteNames}).
@ -137,9 +134,20 @@ with lib;
}
)
{
main = ["dark" "light"];
accent = ["pastel" "dark" "bright"];
state = ["pastel" "dark" "bright"];
main = [
"dark"
"light"
];
accent = [
"pastel"
"dark"
"bright"
];
state = [
"pastel"
"dark"
"bright"
];
};
};
}
};
}

View file

@ -6,68 +6,68 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "poimandres";
isColorscheme = true;
originalName = "poimandres.nvim";
defaultPackage = pkgs.vimPlugins.poimandres-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "poimandres";
isColorscheme = true;
originalName = "poimandres.nvim";
defaultPackage = pkgs.vimPlugins.poimandres-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-04-15: remove 2024-06-15
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"boldVertSplit"
"darkVariant"
"disableBackground"
"disableFloatBackground"
"disableItalics"
"dimNcBackground"
"groups"
"highlightGroups"
];
# TODO introduced 2024-04-15: remove 2024-06-15
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"boldVertSplit"
"darkVariant"
"disableBackground"
"disableFloatBackground"
"disableItalics"
"dimNcBackground"
"groups"
"highlightGroups"
];
settingsOptions = {
bold_vert_split = helpers.defaultNullOpts.mkBool false ''
Use bold vertical separators.
'';
settingsOptions = {
bold_vert_split = helpers.defaultNullOpts.mkBool false ''
Use bold vertical separators.
'';
dim_nc_background = helpers.defaultNullOpts.mkBool false ''
Dim 'non-current' window backgrounds.
'';
dim_nc_background = helpers.defaultNullOpts.mkBool false ''
Dim 'non-current' window backgrounds.
'';
disable_background = helpers.defaultNullOpts.mkBool false ''
Whether to disable the background.
'';
disable_background = helpers.defaultNullOpts.mkBool false ''
Whether to disable the background.
'';
disable_float_background = helpers.defaultNullOpts.mkBool false ''
Whether to disable the background for floats.
'';
disable_float_background = helpers.defaultNullOpts.mkBool false ''
Whether to disable the background for floats.
'';
disable_italics = helpers.defaultNullOpts.mkBool false ''
Whether to disable italics.
'';
disable_italics = helpers.defaultNullOpts.mkBool false ''
Whether to disable italics.
'';
dark_variant = helpers.defaultNullOpts.mkStr "main" ''
Dark variant.
'';
dark_variant = helpers.defaultNullOpts.mkStr "main" ''
Dark variant.
'';
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
Which color to use for each group.
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
Which color to use for each group.
default: see [source](https://github.com/olivercederborg/poimandres.nvim/blob/main/lua/poimandres/init.lua)
'';
default: see [source](https://github.com/olivercederborg/poimandres.nvim/blob/main/lua/poimandres/init.lua)
'';
highlight_groups = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Highlight groups.
'';
};
highlight_groups = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
Highlight groups.
'';
};
settingsExample = {
bold_vert_split = false;
dim_nc_background = true;
disable_background = false;
disable_float_background = false;
disable_italics = true;
};
}
settingsExample = {
bold_vert_split = false;
dim_nc_background = true;
disable_background = false;
disable_float_background = false;
disable_italics = true;
};
}

View file

@ -6,136 +6,155 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "rose-pine";
isColorscheme = true;
defaultPackage = pkgs.vimPlugins.rose-pine;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "rose-pine";
isColorscheme = true;
defaultPackage = pkgs.vimPlugins.rose-pine;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-04-15: remove 2024-06-15
optionsRenamedToSettings = [
"groups"
"highlightGroups"
];
imports = let
basePluginPath = ["colorschemes" "rose-pine"];
in [
(
mkRenamedOptionModule
(basePluginPath ++ ["style"])
(basePluginPath ++ ["settings" "dark_variant"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["dimInactive"])
(basePluginPath ++ ["settings" "dim_inactive_windows"])
)
(
mkRemovedOptionModule
(basePluginPath ++ ["disableItalics"])
"Use `colorschemes.rose-pine.settings.enable.italics` instead."
)
(
mkRemovedOptionModule
(basePluginPath ++ ["boldVerticalSplit"])
"Use `colorschemes.rose-pine.settings.highlight_groups` instead."
)
(
mkRemovedOptionModule
(basePluginPath ++ ["transparentFloat"])
"Use `colorschemes.rose-pine.settings.highlight_groups.NormalFloat` instead."
)
(
mkRenamedOptionModule
(basePluginPath ++ ["transparentBackground"])
(basePluginPath ++ ["settings" "enable" "transparency"])
)
# TODO introduced 2024-04-15: remove 2024-06-15
optionsRenamedToSettings = [
"groups"
"highlightGroups"
];
imports =
let
basePluginPath = [
"colorschemes"
"rose-pine"
];
in
[
(mkRenamedOptionModule (basePluginPath ++ [ "style" ]) (
basePluginPath
++ [
"settings"
"dark_variant"
]
))
(mkRenamedOptionModule (basePluginPath ++ [ "dimInactive" ]) (
basePluginPath
++ [
"settings"
"dim_inactive_windows"
]
))
(mkRemovedOptionModule (
basePluginPath ++ [ "disableItalics" ]
) "Use `colorschemes.rose-pine.settings.enable.italics` instead.")
(mkRemovedOptionModule (
basePluginPath ++ [ "boldVerticalSplit" ]
) "Use `colorschemes.rose-pine.settings.highlight_groups` instead.")
(mkRemovedOptionModule (
basePluginPath ++ [ "transparentFloat" ]
) "Use `colorschemes.rose-pine.settings.highlight_groups.NormalFloat` instead.")
(mkRenamedOptionModule (basePluginPath ++ [ "transparentBackground" ]) (
basePluginPath
++ [
"settings"
"enable"
"transparency"
]
))
];
settingsOptions = {
variant = helpers.mkNullOrOption (types.enum ["auto" "main" "moon" "dawn"]) ''
Set the desired variant: "auto" will follow the vim background, defaulting to `dark_variant`
or "main" for dark and "dawn" for light.
'';
settingsOptions = {
variant =
helpers.mkNullOrOption
(types.enum [
"auto"
"main"
"moon"
"dawn"
])
''
Set the desired variant: "auto" will follow the vim background, defaulting to `dark_variant`
or "main" for dark and "dawn" for light.
'';
dark_variant = helpers.defaultNullOpts.mkEnumFirstDefault ["main" "moon" "dawn"] ''
Set the desired dark variant when `settings.variant` is set to "auto".
'';
dark_variant =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"main"
"moon"
"dawn"
]
''
Set the desired dark variant when `settings.variant` is set to "auto".
'';
dim_inactive_windows = helpers.defaultNullOpts.mkBool false ''
Differentiate between active and inactive windows and panels.
'';
dim_inactive_windows = helpers.defaultNullOpts.mkBool false ''
Differentiate between active and inactive windows and panels.
'';
extend_background_behind_borders = helpers.defaultNullOpts.mkBool true ''
Extend background behind borders.
Appearance differs based on which border characters you are using.
'';
extend_background_behind_borders = helpers.defaultNullOpts.mkBool true ''
Extend background behind borders.
Appearance differs based on which border characters you are using.
'';
enable = {
legacy_highlights = helpers.defaultNullOpts.mkBool true "Enable legacy highlights.";
enable = {
legacy_highlights = helpers.defaultNullOpts.mkBool true "Enable legacy highlights.";
migrations = helpers.defaultNullOpts.mkBool true "Enable migrations.";
migrations = helpers.defaultNullOpts.mkBool true "Enable migrations.";
terminal = helpers.defaultNullOpts.mkBool true "Enable terminal.";
};
styles = {
bold = helpers.defaultNullOpts.mkBool true "Enable bold.";
italic = helpers.defaultNullOpts.mkBool true "Enable italic.";
transparency = helpers.defaultNullOpts.mkBool true "Enable transparency.";
};
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
Highlight groups.
default: see [source](https://github.com/rose-pine/neovim/blob/main/lua/rose-pine/config.lua)
'';
highlight_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
Custom highlight groups.
'';
before_highlight = helpers.defaultNullOpts.mkLuaFn "function(group, highlight, palette) end" ''
Called before each highlight group, before setting the highlight.
`function(group, highlight, palette)`
```lua
@param group string
@param highlight Highlight
@param palette Palette
```
'';
terminal = helpers.defaultNullOpts.mkBool true "Enable terminal.";
};
settingsExample = {
variant = "auto";
dark_variant = "moon";
dim_inactive_windows = true;
extend_background_behind_borders = true;
enable = {
legacy_highlights = false;
migrations = true;
terminal = false;
};
styles = {
bold = false;
italic = true;
transparency = true;
};
groups = {
border = "muted";
link = "iris";
panel = "surface";
};
highlight_groups = {};
before_highlight = "function(group, highlight, palette) end";
styles = {
bold = helpers.defaultNullOpts.mkBool true "Enable bold.";
italic = helpers.defaultNullOpts.mkBool true "Enable italic.";
transparency = helpers.defaultNullOpts.mkBool true "Enable transparency.";
};
extraConfig = cfg: {
opts.termguicolors = mkDefault true;
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
Highlight groups.
default: see [source](https://github.com/rose-pine/neovim/blob/main/lua/rose-pine/config.lua)
'';
highlight_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
Custom highlight groups.
'';
before_highlight = helpers.defaultNullOpts.mkLuaFn "function(group, highlight, palette) end" ''
Called before each highlight group, before setting the highlight.
`function(group, highlight, palette)`
```lua
@param group string
@param highlight Highlight
@param palette Palette
```
'';
};
settingsExample = {
variant = "auto";
dark_variant = "moon";
dim_inactive_windows = true;
extend_background_behind_borders = true;
enable = {
legacy_highlights = false;
migrations = true;
terminal = false;
};
}
styles = {
bold = false;
italic = true;
transparency = true;
};
groups = {
border = "muted";
link = "iris";
panel = "surface";
};
highlight_groups = { };
before_highlight = "function(group, highlight, palette) end";
};
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
}

View file

@ -6,56 +6,87 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "tokyonight";
isColorscheme = true;
originalName = "tokyonight.nvim";
defaultPackage = pkgs.vimPlugins.tokyonight-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "tokyonight";
isColorscheme = true;
originalName = "tokyonight.nvim";
defaultPackage = pkgs.vimPlugins.tokyonight-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-04-15: remove 2024-06-15
optionsRenamedToSettings = [
"style"
"transparent"
"terminalColors"
["styles" "comments"]
["styles" "keywords"]
["styles" "functions"]
["styles" "variables"]
["styles" "sidebars"]
["styles" "floats"]
# TODO introduced 2024-04-15: remove 2024-06-15
optionsRenamedToSettings = [
"style"
"transparent"
"terminalColors"
[
"styles"
"comments"
]
[
"styles"
"keywords"
]
[
"styles"
"functions"
]
[
"styles"
"variables"
]
[
"styles"
"sidebars"
"dayBrightness"
"hideInactiveStatusline"
"dimInactive"
"lualineBold"
"onColors"
"onHighlights"
];
]
[
"styles"
"floats"
]
"sidebars"
"dayBrightness"
"hideInactiveStatusline"
"dimInactive"
"lualineBold"
"onColors"
"onHighlights"
];
settingsOptions = {
style = helpers.defaultNullOpts.mkEnumFirstDefault ["storm" "night" "day"] ''
The theme comes in three styles, `storm`, a darker variant `night` and `day`.
'';
settingsOptions = {
style =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"storm"
"night"
"day"
]
''
The theme comes in three styles, `storm`, a darker variant `night` and `day`.
'';
light_style = helpers.defaultNullOpts.mkStr "day" ''
The theme to use when the background is set to `light`.
'';
light_style = helpers.defaultNullOpts.mkStr "day" ''
The theme to use when the background is set to `light`.
'';
transparent = helpers.defaultNullOpts.mkBool false ''
Disable setting the background color.
'';
transparent = helpers.defaultNullOpts.mkBool false ''
Disable setting the background color.
'';
terminal_colors = helpers.defaultNullOpts.mkBool true ''
Configure the colors used when opening a :terminal in Neovim
'';
terminal_colors = helpers.defaultNullOpts.mkBool true ''
Configure the colors used when opening a :terminal in Neovim
'';
styles = let
mkBackgroundStyle = name:
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
"Background style for ${name}";
in {
styles =
let
mkBackgroundStyle =
name:
helpers.defaultNullOpts.mkEnumFirstDefault [
"dark"
"transparent"
"normal"
] "Background style for ${name}";
in
{
comments = helpers.defaultNullOpts.mkHighlight "{italic = true;}" "" ''
Define comments highlight properties.
'';
@ -77,65 +108,68 @@ with lib;
floats = mkBackgroundStyle "floats";
};
sidebars = helpers.defaultNullOpts.mkListOf types.str ''["qf" "help"]'' ''
Set a darker background on sidebar-like windows.
'';
sidebars = helpers.defaultNullOpts.mkListOf types.str ''["qf" "help"]'' ''
Set a darker background on sidebar-like windows.
'';
day_brightness = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3" ''
Adjusts the brightness of the colors of the **Day** style.
Number between 0 and 1, from dull to vibrant colors.
'';
day_brightness = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3" ''
Adjusts the brightness of the colors of the **Day** style.
Number between 0 and 1, from dull to vibrant colors.
'';
hide_inactive_statusline = helpers.defaultNullOpts.mkBool false ''
Enabling this option will hide inactive statuslines and replace them with a thin border instead.
Should work with the standard **StatusLine** and **LuaLine**.
'';
hide_inactive_statusline = helpers.defaultNullOpts.mkBool false ''
Enabling this option will hide inactive statuslines and replace them with a thin border instead.
Should work with the standard **StatusLine** and **LuaLine**.
'';
dim_inactive = helpers.defaultNullOpts.mkBool false ''
Dims inactive windows.
'';
dim_inactive = helpers.defaultNullOpts.mkBool false ''
Dims inactive windows.
'';
lualine_bold = helpers.defaultNullOpts.mkBool false ''
When true, section headers in the lualine theme will be bold.
'';
lualine_bold = helpers.defaultNullOpts.mkBool false ''
When true, section headers in the lualine theme will be bold.
'';
on_colors = helpers.defaultNullOpts.mkLuaFn "function(colors) end" ''
Override specific color groups to use other groups or a hex color.
Function will be called with a `ColorScheme` table.
`@param colors ColorScheme`
'';
on_colors = helpers.defaultNullOpts.mkLuaFn "function(colors) end" ''
Override specific color groups to use other groups or a hex color.
Function will be called with a `ColorScheme` table.
`@param colors ColorScheme`
'';
on_highlights = helpers.defaultNullOpts.mkLuaFn "function(highlights, colors) end" ''
Override specific highlights to use other groups or a hex color.
Function will be called with a `Highlights` and `ColorScheme` table.
`@param highlights Highlights`
`@param colors ColorScheme`
'';
on_highlights = helpers.defaultNullOpts.mkLuaFn "function(highlights, colors) end" ''
Override specific highlights to use other groups or a hex color.
Function will be called with a `Highlights` and `ColorScheme` table.
`@param highlights Highlights`
`@param colors ColorScheme`
'';
};
settingsExample = {
style = "storm";
light_style = "day";
transparent = false;
terminal_colors = true;
styles = {
comments.italic = true;
keywords.italic = true;
functions = { };
variables = { };
sidebars = "dark";
floats = "dark";
};
sidebars = [
"qf"
"vista_kind"
"terminal"
"packer"
];
day_brightness = 0.3;
hide_inactive_statusline = false;
dim_inactive = false;
lualine_bold = false;
on_colors = "function(colors) end";
on_highlights = "function(highlights, colors) end";
};
settingsExample = {
style = "storm";
light_style = "day";
transparent = false;
terminal_colors = true;
styles = {
comments.italic = true;
keywords.italic = true;
functions = {};
variables = {};
sidebars = "dark";
floats = "dark";
};
sidebars = ["qf" "vista_kind" "terminal" "packer"];
day_brightness = 0.3;
hide_inactive_statusline = false;
dim_inactive = false;
lualine_bold = false;
on_colors = "function(colors) end";
on_highlights = "function(highlights, colors) end";
};
extraConfig = cfg: {
opts.termguicolors = mkDefault true;
};
}
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
}

View file

@ -6,42 +6,38 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "vscode";
isColorscheme = true;
originalName = "vscode-nvim";
defaultPackage = pkgs.vimPlugins.vscode-nvim;
colorscheme = null; # Color scheme is set by `require.("vscode").load()`
callSetup = false;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "vscode";
isColorscheme = true;
originalName = "vscode-nvim";
defaultPackage = pkgs.vimPlugins.vscode-nvim;
colorscheme = null; # Color scheme is set by `require.("vscode").load()`
callSetup = false;
maintainers = [maintainers.loicreynier];
maintainers = [ maintainers.loicreynier ];
settingsOptions = {
transparent = helpers.defaultNullOpts.mkBool false "Whether to enable transparent background";
italic_comments = helpers.defaultNullOpts.mkBool false "Whether to enable italic comments";
underline_links = helpers.defaultNullOpts.mkBool false "Whether to underline links";
disable_nvimtree_bg = helpers.defaultNullOpts.mkBool true "Whether to disable nvim-tree background";
color_overrides =
helpers.defaultNullOpts.mkAttrsOf types.str
"{}"
''
A dictionary of color overrides.
See https://github.com/Mofiqul/vscode.nvim/blob/main/lua/vscode/colors.lua for color names.
'';
group_overrides = with helpers;
defaultNullOpts.mkAttrsOf nixvimTypes.highlight
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
'';
};
extraConfig = cfg: {
extraConfigLuaPre = ''
local _vscode = require("vscode")
_vscode.setup(${helpers.toLuaObject cfg.settings})
_vscode.load()
settingsOptions = {
transparent = helpers.defaultNullOpts.mkBool false "Whether to enable transparent background";
italic_comments = helpers.defaultNullOpts.mkBool false "Whether to enable italic comments";
underline_links = helpers.defaultNullOpts.mkBool false "Whether to underline links";
disable_nvimtree_bg = helpers.defaultNullOpts.mkBool true "Whether to disable nvim-tree background";
color_overrides = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
A dictionary of color overrides.
See https://github.com/Mofiqul/vscode.nvim/blob/main/lua/vscode/colors.lua for color names.
'';
group_overrides =
with helpers;
defaultNullOpts.mkAttrsOf nixvimTypes.highlight "{}" ''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
'';
};
}
};
extraConfig = cfg: {
extraConfigLuaPre = ''
local _vscode = require("vscode")
_vscode.setup(${helpers.toLuaObject cfg.settings})
_vscode.load()
'';
};
}

View file

@ -6,81 +6,61 @@
...
}:
with helpers.vim-plugin;
with lib; rec {
mkCmpSourcePlugin = {
name,
extraPlugins ? [],
useDefaultPackage ? true,
...
}:
with lib;
rec {
mkCmpSourcePlugin =
{
name,
extraPlugins ? [ ],
useDefaultPackage ? true,
...
}:
mkVimPlugin config {
inherit name;
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
};
extractSourcesFromOptionValue = sources:
if isList sources
then sources
else [];
extractSourcesFromOptionValue = sources: if isList sources then sources else [ ];
autoInstallSourcePluginsModule = cfg: let
# cfg.setup.sources
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
# cfg.filetype.<name>.sources
filetypeSources =
mapAttrsToList
(_: filetypeConfig:
extractSourcesFromOptionValue filetypeConfig.sources)
cfg.filetype;
# cfg.cmdline.<name>.sources
cmdlineSources =
mapAttrsToList
(_: cmdlineConfig:
extractSourcesFromOptionValue cmdlineConfig.sources)
cfg.cmdline;
autoInstallSourcePluginsModule =
cfg:
let
# cfg.setup.sources
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
# cfg.filetype.<name>.sources
filetypeSources = mapAttrsToList (
_: filetypeConfig: extractSourcesFromOptionValue filetypeConfig.sources
) cfg.filetype;
# cfg.cmdline.<name>.sources
cmdlineSources = mapAttrsToList (
_: cmdlineConfig: extractSourcesFromOptionValue cmdlineConfig.sources
) cfg.cmdline;
# [{name = "foo";} {name = "bar"; x = 42;} ...]
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
# [{name = "foo";} {name = "bar"; x = 42;} ...]
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
# Take only the names from the sources provided by the user
# ["foo" "bar"]
foundSources =
lists.unique
(
map
(source: source.name)
allSources
);
# Take only the names from the sources provided by the user
# ["foo" "bar"]
foundSources = lists.unique (map (source: source.name) allSources);
# If the user has enabled the `foo` and `bar` sources, this attrs will look like:
# {
# cmp-foo.enable = true;
# cmp-bar.enable = true;
# }
attrsEnabled =
mapAttrs'
(
sourceName: pluginName: {
name = pluginName;
value.enable =
mkIf
(elem sourceName foundSources)
true;
}
)
(import ./sources.nix);
# If the user has enabled the `foo` and `bar` sources, this attrs will look like:
# {
# cmp-foo.enable = true;
# cmp-bar.enable = true;
# }
attrsEnabled = mapAttrs' (sourceName: pluginName: {
name = pluginName;
value.enable = mkIf (elem sourceName foundSources) true;
}) (import ./sources.nix);
lspCapabilities =
mkIf
(elem "nvim_lsp" foundSources)
{
lspCapabilities = mkIf (elem "nvim_lsp" foundSources) {
lsp.capabilities = ''
capabilities = vim.tbl_deep_extend("force", capabilities, require('cmp_nvim_lsp').default_capabilities())
'';
};
in
in
mkMerge [
(mkIf cfg.autoEnableSources attrsEnabled)
lspCapabilities

View file

@ -4,42 +4,45 @@
pkgs,
config,
...
} @ args: let
cmpOptions = import ./options {inherit lib helpers;};
}@args:
let
cmpOptions = import ./options { inherit lib helpers; };
in
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "cmp";
originalName = "nvim-cmp";
defaultPackage = pkgs.vimPlugins.nvim-cmp;
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "cmp";
originalName = "nvim-cmp";
defaultPackage = pkgs.vimPlugins.nvim-cmp;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# Introduced on 2024 February 21
# TODO: remove ~June 2024
imports = [
./deprecations.nix
./sources
];
deprecateExtraOptions = true;
# Introduced on 2024 February 21
# TODO: remove ~June 2024
imports = [
./deprecations.nix
./sources
];
deprecateExtraOptions = true;
extraOptions = {
autoEnableSources = mkOption {
type = types.bool;
default = true;
description = ''
Scans the sources array and installs the plugins if they are known to nixvim.
'';
};
extraOptions = {
autoEnableSources = mkOption {
type = types.bool;
default = true;
description = ''
Scans the sources array and installs the plugins if they are known to nixvim.
'';
};
inherit (cmpOptions) filetype cmdline;
};
inherit (cmpOptions) filetype cmdline;
};
inherit (cmpOptions) settingsOptions settingsExample;
inherit (cmpOptions) settingsOptions settingsExample;
callSetup = false;
extraConfig = cfg: {
warnings = optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources)) ''
callSetup = false;
extraConfig = cfg: {
warnings =
optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources))
''
Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically
enable the source plugins with respect to the list of sources provided in `settings.sources`.
However, the latter is proveded as a raw lua string which is not parseable by Nixvim.
@ -49,35 +52,25 @@ in
- Dismiss this warning by explicitly setting `autoEnableSources` to `false`;
'';
extraConfigLua =
''
local cmp = require('cmp')
cmp.setup(${helpers.toLuaObject cfg.settings})
extraConfigLua =
''
local cmp = require('cmp')
cmp.setup(${helpers.toLuaObject cfg.settings})
''
+ (
concatStringsSep "\n"
(
mapAttrsToList
(
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
)
cfg.filetype
)
)
+ (
concatStringsSep "\n"
(
mapAttrsToList
(
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
)
cfg.cmdline
)
);
''
+ (concatStringsSep "\n" (
mapAttrsToList (
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
) cfg.filetype
))
+ (concatStringsSep "\n" (
mapAttrsToList (
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
) cfg.cmdline
));
# If autoEnableSources is set to true, figure out which are provided by the user
# and enable the corresponding plugins.
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
};
}
# If autoEnableSources is set to true, figure out which are provided by the user
# and enable the corresponding plugins.
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
};
}

View file

@ -1,164 +1,360 @@
{lib, ...}:
with lib; let
oldPluginBasePath = ["plugins" "nvim-cmp"];
newPluginBasePath = ["plugins" "cmp"];
settingsPath = newPluginBasePath ++ ["settings"];
{ lib, ... }:
with lib;
let
oldPluginBasePath = [
"plugins"
"nvim-cmp"
];
newPluginBasePath = [
"plugins"
"cmp"
];
settingsPath = newPluginBasePath ++ [ "settings" ];
renamedOptions = [
{old = ["performance" "debounce"];}
{old = ["performance" "throttle"];}
{
old = ["performance" "fetchingTimeout"];
new = ["performance" "fetching_timeout"];
old = [
"performance"
"debounce"
];
}
{
old = ["performance" "asyncBudget"];
new = ["performance" "async_budget"];
old = [
"performance"
"throttle"
];
}
{
old = ["performance" "maxViewEntries"];
new = ["performance" "max_view_entries"];
}
{old = ["mapping"];}
{
old = ["completion" "keywordLength"];
new = ["completion" "keyword_length"];
old = [
"performance"
"fetchingTimeout"
];
new = [
"performance"
"fetching_timeout"
];
}
{
old = ["completion" "keywordPattern"];
new = ["completion" "keyword_pattern"];
}
{old = ["completion" "autocomplete"];}
{old = ["completion" "completeopt"];}
{
old = ["confirmation" "getCommitCharacters"];
new = ["confirmation" "get_commit_characters"];
old = [
"performance"
"asyncBudget"
];
new = [
"performance"
"async_budget"
];
}
{
old = ["formatting" "expandableIndicator"];
new = ["formatting" "expandable_indicator"];
old = [
"performance"
"maxViewEntries"
];
new = [
"performance"
"max_view_entries"
];
}
{old = ["formatting" "fields"];}
{old = ["formatting" "format"];}
{ old = [ "mapping" ]; }
{
old = ["matching" "disallowFuzzyMatching"];
new = ["matching" "disallow_fuzzy_matching"];
old = [
"completion"
"keywordLength"
];
new = [
"completion"
"keyword_length"
];
}
{
old = ["matching" "disallowFullfuzzyMatching"];
new = ["matching" "disallow_fullfuzzy_matching"];
old = [
"completion"
"keywordPattern"
];
new = [
"completion"
"keyword_pattern"
];
}
{
old = ["matching" "disallowPartialFuzzyMatching"];
new = ["matching" "disallow_partial_fuzzy_matching"];
old = [
"completion"
"autocomplete"
];
}
{
old = ["matching" "disallowPartialMatching"];
new = ["matching" "disallow_partial_matching"];
old = [
"completion"
"completeopt"
];
}
{
old = ["matching" "disallowPrefixUnmatching"];
new = ["matching" "disallow_prefix_unmatching"];
old = [
"confirmation"
"getCommitCharacters"
];
new = [
"confirmation"
"get_commit_characters"
];
}
{
old = ["sorting" "priorityWeight"];
new = ["sorting" "priority_weight"];
}
{old = ["view" "entries"];}
{
old = ["view" "docs" "autoOpen"];
new = ["view" "docs" "auto_open"];
}
{old = ["window" "completion" "border"];}
{old = ["window" "completion" "winhighlight"];}
{old = ["window" "completion" "zindex"];}
{old = ["window" "completion" "scrolloff"];}
{
old = ["window" "completion" "colOffset"];
new = ["window" "completion" "col_offset"];
old = [
"formatting"
"expandableIndicator"
];
new = [
"formatting"
"expandable_indicator"
];
}
{
old = ["window" "completion" "sidePadding"];
new = ["window" "completion" "side_padding"];
}
{old = ["window" "completion" "scrollbar"];}
{old = ["window" "documentation" "border"];}
{old = ["window" "documentation" "winhighlight"];}
{old = ["window" "documentation" "zindex"];}
{
old = ["window" "documentation" "maxWidth"];
new = ["window" "documentation" "max_width"];
old = [
"formatting"
"fields"
];
}
{
old = ["window" "documentation" "maxHeight"];
new = ["window" "documentation" "max_height"];
old = [
"formatting"
"format"
];
}
{old = ["experimental"];}
{
old = [
"matching"
"disallowFuzzyMatching"
];
new = [
"matching"
"disallow_fuzzy_matching"
];
}
{
old = [
"matching"
"disallowFullfuzzyMatching"
];
new = [
"matching"
"disallow_fullfuzzy_matching"
];
}
{
old = [
"matching"
"disallowPartialFuzzyMatching"
];
new = [
"matching"
"disallow_partial_fuzzy_matching"
];
}
{
old = [
"matching"
"disallowPartialMatching"
];
new = [
"matching"
"disallow_partial_matching"
];
}
{
old = [
"matching"
"disallowPrefixUnmatching"
];
new = [
"matching"
"disallow_prefix_unmatching"
];
}
{
old = [
"sorting"
"priorityWeight"
];
new = [
"sorting"
"priority_weight"
];
}
{
old = [
"view"
"entries"
];
}
{
old = [
"view"
"docs"
"autoOpen"
];
new = [
"view"
"docs"
"auto_open"
];
}
{
old = [
"window"
"completion"
"border"
];
}
{
old = [
"window"
"completion"
"winhighlight"
];
}
{
old = [
"window"
"completion"
"zindex"
];
}
{
old = [
"window"
"completion"
"scrolloff"
];
}
{
old = [
"window"
"completion"
"colOffset"
];
new = [
"window"
"completion"
"col_offset"
];
}
{
old = [
"window"
"completion"
"sidePadding"
];
new = [
"window"
"completion"
"side_padding"
];
}
{
old = [
"window"
"completion"
"scrollbar"
];
}
{
old = [
"window"
"documentation"
"border"
];
}
{
old = [
"window"
"documentation"
"winhighlight"
];
}
{
old = [
"window"
"documentation"
"zindex"
];
}
{
old = [
"window"
"documentation"
"maxWidth"
];
new = [
"window"
"documentation"
"max_width"
];
}
{
old = [
"window"
"documentation"
"maxHeight"
];
new = [
"window"
"documentation"
"max_height"
];
}
{ old = [ "experimental" ]; }
];
renameWarnings =
map
(
rename:
mkRenamedOptionModule
(oldPluginBasePath ++ rename.old)
(settingsPath ++ (rename.new or rename.old))
renameWarnings = map (
rename:
mkRenamedOptionModule (oldPluginBasePath ++ rename.old) (settingsPath ++ (rename.new or rename.old))
) renamedOptions;
in
{
imports = renameWarnings ++ [
(mkRenamedOptionModule (oldPluginBasePath ++ [ "enable" ]) (newPluginBasePath ++ [ "enable" ]))
(mkRenamedOptionModule (oldPluginBasePath ++ [ "autoEnableSources" ]) (
newPluginBasePath ++ [ "autoEnableSources" ]
))
(mkRemovedOptionModule (oldPluginBasePath ++ [ "preselect" ]) ''
Use `plugins.cmp.settings.preselect` option. But watch out, you now have to explicitly write `cmp.PreselectMode.<mode>`.
See the option documentation for more details.
'')
(mkRemovedOptionModule (oldPluginBasePath ++ [ "mappingPresets" ])
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
)
renamedOptions;
in {
imports =
renameWarnings
++ [
(mkRemovedOptionModule
(
mkRenamedOptionModule
(oldPluginBasePath ++ ["enable"])
(newPluginBasePath ++ ["enable"])
oldPluginBasePath
++ [
"snippet"
"expand"
]
)
''
Use `plugins.cmp.settings.snippet.expand` option. But watch out, you can no longer put only the name of the snippet engine.
If you use `luasnip` for instance, set:
```
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
```
''
)
(mkRemovedOptionModule
(
mkRenamedOptionModule
(oldPluginBasePath ++ ["autoEnableSources"])
(newPluginBasePath ++ ["autoEnableSources"])
oldPluginBasePath
++ [
"sorting"
"comparators"
]
)
(
mkRemovedOptionModule
(oldPluginBasePath ++ ["preselect"])
''
Use `plugins.cmp.settings.preselect` option. But watch out, you now have to explicitly write `cmp.PreselectMode.<mode>`.
See the option documentation for more details.
''
)
(
mkRemovedOptionModule
(oldPluginBasePath ++ ["mappingPresets"])
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
)
(
mkRemovedOptionModule
(oldPluginBasePath ++ ["snippet" "expand"])
''
Use `plugins.cmp.settings.snippet.expand` option. But watch out, you can no longer put only the name of the snippet engine.
If you use `luasnip` for instance, set:
```
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
```
''
)
(
mkRemovedOptionModule
(oldPluginBasePath ++ ["sorting" "comparators"])
''
Use `plugins.cmp.settings.sorting.comparators` option. But watch out, you can no longer put only the name of the comparators.
See the option documentation for more details.
''
)
(
mkRemovedOptionModule
(oldPluginBasePath ++ ["sources"])
''
Use `plugins.cmp.settings.sources` option. But watch out, you can no longer provide a list of lists of sources.
For this type of use, directly write lua.
See the option documentation for more details.
''
)
];
''
Use `plugins.cmp.settings.sorting.comparators` option. But watch out, you can no longer put only the name of the comparators.
See the option documentation for more details.
''
)
(mkRemovedOptionModule (oldPluginBasePath ++ [ "sources" ]) ''
Use `plugins.cmp.settings.sources` option. But watch out, you can no longer provide a list of lists of sources.
For this type of use, directly write lua.
See the option documentation for more details.
'')
];
}

View file

@ -1,9 +1,7 @@
{
lib,
helpers,
}:
with lib; rec {
settingsOptions = import ./settings-options.nix {inherit lib helpers;};
{ lib, helpers }:
with lib;
rec {
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
settingsExample = {
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
@ -29,46 +27,44 @@ with lib; rec {
'';
};
attrsOfOptions = with types;
attrsOf (
submodule {
freeformType = attrsOf anything;
options = settingsOptions;
}
);
attrsOfOptions =
with types;
attrsOf (submodule {
freeformType = attrsOf anything;
options = settingsOptions;
});
filetype = mkOption {
type = attrsOfOptions;
default = {};
default = { };
description = "Options for `cmp.filetype()`.";
example = {
python = {
sources = [
{name = "nvim_lsp";}
];
sources = [ { name = "nvim_lsp"; } ];
};
};
};
cmdline = mkOption {
type = attrsOfOptions;
default = {};
default = { };
description = "Options for `cmp.cmdline()`.";
example = {
"/" = {
mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [
{name = "buffer";}
];
sources = [ { name = "buffer"; } ];
};
":" = {
mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [
{name = "path";}
{ name = "path"; }
{
name = "cmdline";
option = {
ignore_cmds = ["Man" "!"];
ignore_cmds = [
"Man"
"!"
];
};
}
];

View file

@ -1,8 +1,6 @@
{ lib, helpers }:
with lib;
{
lib,
helpers,
}:
with lib; {
performance = {
debounce = helpers.defaultNullOpts.mkUnsignedInt 60 ''
Sets debounce time.
@ -39,16 +37,16 @@ with lib; {
'';
mapping = mkOption {
default = {};
type = with helpers.nixvimTypes;
maybeRaw
(attrsOf strLua);
apply = v:
# Handle the raw case first
if helpers.nixvimTypes.isRawType v
then v
default = { };
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua);
apply =
v:
# Handle the raw case first
if helpers.nixvimTypes.isRawType v then
v
# When v is an attrs **but not {__raw = ...}**
else mapAttrs (_: helpers.mkRaw) v;
else
mapAttrs (_: helpers.mkRaw) v;
example = {
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
@ -110,24 +108,16 @@ with lib; {
The number of characters needed to trigger auto-completion.
'';
keyword_pattern =
helpers.defaultNullOpts.mkLua
''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]''
"The default keyword pattern.";
keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern.";
autocomplete =
helpers.defaultNullOpts.mkNullable
(
with helpers.nixvimTypes;
either
(enum [false])
(listOf strLua)
)
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
''
The event to trigger autocompletion.
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
'';
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
''
The event to trigger autocompletion.
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
'';
completeopt = helpers.defaultNullOpts.mkStr "menu,menuone,noselect" ''
Like vim's completeopt setting.
@ -138,15 +128,15 @@ with lib; {
confirmation = {
get_commit_characters =
helpers.defaultNullOpts.mkLuaFn
''
function(commit_characters)
return commit_characters
end
''
''
You can append or exclude `commitCharacters` via this configuration option function.
The `commitCharacters` are defined by the LSP spec.
'';
''
function(commit_characters)
return commit_characters
end
''
''
You can append or exclude `commitCharacters` via this configuration option function.
The `commitCharacters` are defined by the LSP spec.
'';
};
formatting = {
@ -160,21 +150,21 @@ with lib; {
format =
helpers.defaultNullOpts.mkLuaFn
''
function(_, vim_item)
return vim_item
end
''
''
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
''
function(_, vim_item)
return vim_item
end
''
''
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
The function used to customize the appearance of the completion menu.
See `|complete-items|`.
This value can also be used to modify the `dup` property.
The function used to customize the appearance of the completion menu.
See `|complete-items|`.
This value can also be used to modify the `dup` property.
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
`kind_hl_group` and `menu_hl_group`.
'';
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
`kind_hl_group` and `menu_hl_group`.
'';
};
matching = {
@ -210,12 +200,7 @@ with lib; {
comparators = mkOption {
type = with helpers.nixvimTypes; nullOr (listOf strLuaFn);
apply = v:
helpers.ifNonNull' v (
map
helpers.mkRaw
v
);
apply = v: helpers.ifNonNull' v (map helpers.mkRaw v);
default = null;
description = ''
The function to customize the sorting behavior.
@ -240,26 +225,20 @@ with lib; {
};
};
sources = import ./sources-option.nix {inherit lib helpers;};
sources = import ./sources-option.nix { inherit lib helpers; };
view = {
entries =
helpers.defaultNullOpts.mkNullable
(
with types;
either
str
(attrsOf anything)
)
''
{
name = "custom";
selection_order = "top_down";
}
''
''
The view class used to customize nvim-cmp's appearance.
'';
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
''
{
name = "custom";
selection_order = "top_down";
}
''
''
The view class used to customize nvim-cmp's appearance.
'';
docs = {
auto_open = helpers.defaultNullOpts.mkBool true ''
@ -268,79 +247,71 @@ with lib; {
};
};
window = let
mkWinhighlightOption = default:
helpers.defaultNullOpts.mkStr
default
''
Specify the window's winhighlight option.
window =
let
mkWinhighlightOption =
default:
helpers.defaultNullOpts.mkStr default ''
Specify the window's winhighlight option.
See `|nvim_open_win|`.
'';
zindex = helpers.mkNullOrOption types.ints.unsigned ''
The window's zindex.
See `|nvim_open_win|`.
'';
in
{
completion = {
border =
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
"";
zindex = helpers.mkNullOrOption types.ints.unsigned ''
The window's zindex.
See `|nvim_open_win|`.
'';
in {
completion = {
border =
helpers.defaultNullOpts.mkBorder
''[ "" "" "" "" "" "" "" "" ]''
"nvim-cmp completion popup menu"
"";
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
winhighlight =
mkWinhighlightOption
"Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
inherit zindex;
inherit zindex;
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Specify the window's scrolloff option.
See |'scrolloff'|.
'';
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
Specify the window's scrolloff option.
See |'scrolloff'|.
'';
col_offset = helpers.defaultNullOpts.mkInt 0 ''
Offsets the completion window relative to the cursor.
'';
col_offset = helpers.defaultNullOpts.mkInt 0 ''
Offsets the completion window relative to the cursor.
'';
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
The amount of padding to add on the completion window's sides.
'';
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
The amount of padding to add on the completion window's sides.
'';
scrollbar = helpers.defaultNullOpts.mkBool true ''
Whether the scrollbar should be enabled if there are more items that fit.
'';
};
scrollbar = helpers.defaultNullOpts.mkBool true ''
Whether the scrollbar should be enabled if there are more items that fit.
'';
};
documentation = {
border =
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
"nvim-cmp documentation popup menu"
"";
documentation = {
border =
helpers.defaultNullOpts.mkBorder
''[ "" "" "" " " "" "" "" " " ]''
"nvim-cmp documentation popup menu"
"";
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
inherit zindex;
inherit zindex;
max_width =
helpers.mkNullOrStrLuaOr types.ints.unsigned
''
max_width = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
The documentation window's max width.
Default: "math.floor((40 * 2) * (vim.o.columns / (40 * 2 * 16 / 9)))"
'';
max_height =
helpers.mkNullOrStrLuaOr types.ints.unsigned
''
max_height = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
The documentation window's max height.
Default: "math.floor(40 * (40 / vim.o.lines))"
'';
};
};
};
# This can be kept as types.attrs since experimental features are often removed or completely
# changed after a while

View file

@ -1,8 +1,6 @@
{
lib,
helpers,
}:
with lib; let
{ lib, helpers }:
with lib;
let
sourceType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
@ -81,27 +79,26 @@ with lib; let
};
};
in
mkOption {
default = [];
type = with helpers.nixvimTypes;
maybeRaw (listOf sourceType);
description = ''
The sources to use.
Can either be a list of `sourceConfigs` which will be made directly to a Lua object.
Or it can be a raw lua string which might be necessary for more advanced use cases.
mkOption {
default = [ ];
type = with helpers.nixvimTypes; maybeRaw (listOf sourceType);
description = ''
The sources to use.
Can either be a list of `sourceConfigs` which will be made directly to a Lua object.
Or it can be a raw lua string which might be necessary for more advanced use cases.
WARNING:
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
plugins. This will work only when this option is set to a list.
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
your nixvim configuration.
WARNING:
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
plugins. This will work only when this option is set to a list.
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
your nixvim configuration.
Default: `[]`
'';
example = [
{name = "nvim_lsp";}
{name = "luasnip";}
{name = "path";}
{name = "buffer";}
];
}
Default: `[]`
'';
example = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "path"; }
{ name = "buffer"; }
];
}

View file

@ -4,10 +4,12 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-fish;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.cmp-fish = {
fishPackage = mkOption {
@ -21,7 +23,5 @@ in {
};
};
config = mkIf cfg.enable {
extraPackages = [cfg.fishPackage];
};
config = mkIf cfg.enable { extraPackages = [ cfg.fishPackage ]; };
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-git;
in {
in
{
options.plugins.cmp-git.settings = helpers.neovim-plugin.mkSettingsOption {
pluginName = "cmp_git";
options = {
@ -30,13 +32,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').git.commits";}''
"Function used to sort the commits.";
''{__raw = "require('cmp_git.sort').git.commits";}''
"Function used to sort the commits.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').git.commits";}''
"Function used to format the commits.";
''{__raw = "require('cmp_git.format').git.commits";}''
"Function used to format the commits.";
};
};
@ -47,9 +49,8 @@ in {
issues = {
fields =
helpers.defaultNullOpts.mkListOf types.str
''["title" "number" "body" "updatedAt" "state"]''
"The fields used for issues.";
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
"The fields used for issues.";
filter = helpers.defaultNullOpts.mkStr "all" ''
The filter to use when fetching issues.
@ -65,13 +66,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.issues";}''
"Function used to sort the issues.";
''{__raw = "require('cmp_git.sort').github.issues";}''
"Function used to sort the issues.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.issues";}''
"Function used to format the issues.";
''{__raw = "require('cmp_git.format').github.issues";}''
"Function used to format the issues.";
};
mentions = {
@ -81,20 +82,19 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.mentions";}''
"Function used to sort the mentions.";
''{__raw = "require('cmp_git.sort').github.mentions";}''
"Function used to sort the mentions.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.mentions";}''
"Function used to format the mentions.";
''{__raw = "require('cmp_git.format').github.mentions";}''
"Function used to format the mentions.";
};
pull_requests = {
fields =
helpers.defaultNullOpts.mkListOf types.str
''["title" "number" "body" "updatedAt" "state"]''
"The fields used for pull requests.";
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
"The fields used for pull requests.";
limit = helpers.defaultNullOpts.mkUnsignedInt 100 ''
Max number of pull requests to fetch.
@ -106,13 +106,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
"Function used to sort the pull requests.";
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
"Function used to sort the pull requests.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').github.pull_requests";}''
"Function used to format the pull requests.";
''{__raw = "require('cmp_git.format').github.pull_requests";}''
"Function used to format the pull requests.";
};
};
@ -132,13 +132,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
"Function used to sort the issues.";
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
"Function used to sort the issues.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.issues";}''
"Function used to format the issues.";
''{__raw = "require('cmp_git.format').gitlab.issues";}''
"Function used to format the issues.";
};
mentions = {
@ -148,13 +148,13 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
"Function used to sort the mentions.";
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
"Function used to sort the mentions.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
"Function used to format the mentions.";
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
"Function used to format the mentions.";
};
merge_requests = {
@ -168,114 +168,118 @@ in {
sort_by =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
"Function used to sort the merge requests.";
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
"Function used to sort the merge requests.";
format =
helpers.defaultNullOpts.mkNullable types.anything
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
"Function used to format the merge requests.";
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
"Function used to format the merge requests.";
};
};
trigger_actions =
helpers.defaultNullOpts.mkListOf
(types.submodule {
options = {
debug_name = helpers.mkNullOrStr "Debug name.";
(types.submodule {
options = {
debug_name = helpers.mkNullOrStr "Debug name.";
trigger_character = mkOption {
type = types.str;
example = ":";
description = ''
The trigger character.
Has to be a single character
'';
};
trigger_character = mkOption {
type = types.str;
example = ":";
description = ''
The trigger character.
Has to be a single character
'';
};
action = mkOption {
type = helpers.nixvimTypes.strLuaFn;
apply = helpers.mkRaw;
description = ''
The parameters to the action function are the different sources (currently `git`,
`gitlab` and `github`), the completion callback, the trigger character, the
parameters passed to complete from nvim-cmp, and the current git info.
'';
example = ''
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
'';
action = mkOption {
type = helpers.nixvimTypes.strLuaFn;
apply = helpers.mkRaw;
description = ''
The parameters to the action function are the different sources (currently `git`,
`gitlab` and `github`), the completion callback, the trigger character, the
parameters passed to complete from nvim-cmp, and the current git info.
'';
example = ''
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
'';
};
};
};
})
''
[
{
debug_name = "git_commits";
trigger_character = ":";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_issues";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_issues(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mrs";
trigger_character = "!";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_issues_and_pr";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
]
''
''
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
add an entry in the `trigger_actions` list of the config.
The two necessary fields are the `trigger_character` and the `action`.
'';
})
''
[
{
debug_name = "git_commits";
trigger_character = ":";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.git:get_commits(callback, params, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_issues";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_issues(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "gitlab_mrs";
trigger_character = "!";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_issues_and_pr";
trigger_character = "#";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
end
\'\';
}
{
debug_name = "github_mentions";
trigger_character = "@";
action = \'\'
function(sources, trigger_char, callback, params, git_info)
return sources.github:get_mentions(callback, git_info, trigger_char)
end
\'\';
}
]
''
''
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
add an entry in the `trigger_actions` list of the config.
The two necessary fields are the `trigger_character` and the `action`.
'';
};
example = {
remotes = ["upstream" "origin" "foo"];
remotes = [
"upstream"
"origin"
"foo"
];
github.issues = {
filter = "all";
limit = 250;

View file

@ -4,41 +4,44 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-tabby;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.cmp-tabby =
helpers.neovim-plugin.extraOptionsOptions
// {
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
The address of the tabby host server.
'';
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
The address of the tabby host server.
'';
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
The max number of lines to complete.
'';
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
The max number of lines to complete.
'';
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
Whether to run the completion on every keystroke.
'';
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
Whether to run the completion on every keystroke.
'';
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
};
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
};
config = mkIf cfg.enable {
extraConfigLua = let
setupOptions = with cfg;
{
inherit host;
max_lines = maxLines;
run_on_every_keystroke = runOnEveryKeyStroke;
inherit stop;
}
// cfg.extraOptions;
in ''
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
'';
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit host;
max_lines = maxLines;
run_on_every_keystroke = runOnEveryKeyStroke;
inherit stop;
}
// cfg.extraOptions;
in
''
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.cmp-tabnine;
in {
in
{
options.plugins.cmp-tabnine = helpers.neovim-plugin.extraOptionsOptions;
config = mkIf cfg.enable {

View file

@ -5,85 +5,79 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.codeium-nvim;
in {
meta.maintainers = [maintainers.GaetanLepage];
in
{
meta.maintainers = [ maintainers.GaetanLepage ];
options.plugins.codeium-nvim =
helpers.neovim-plugin.extraOptionsOptions
// {
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
configPath =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}''
"The path to the config file, used to store the API key.";
configPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}'' "The path to the config file, used to store the API key.";
binPath =
helpers.defaultNullOpts.mkStr
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}''
"The path to the directory where the Codeium server will be downloaded to.";
binPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}'' "The path to the directory where the Codeium server will be downloaded to.";
api = {
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
The hostname of the API server to use.
'';
api = {
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
The hostname of the API server to use.
'';
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
The port of the API server to use.
'';
};
tools = {
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
languageServer = helpers.mkNullOrOption types.str ''
The path to the language server downloaded from the official source.
'';
};
wrapper = helpers.mkNullOrOption types.str ''
The path to a wrapper script/binary that is used to execute any binaries not listed under
tools.
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
codeium server.
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
The port of the API server to use.
'';
};
config = mkIf cfg.enable {
extraConfigLua = let
setupOptions = with cfg;
{
config_path = configPath;
bin_path = binPath;
api = with api; {
inherit host;
port =
if isInt port
then toString port
else port;
};
tools = with tools; {
inherit
uname
uuidgen
curl
gzip
;
language_server = languageServer;
};
inherit wrapper;
}
// cfg.extraOptions;
in ''
require('codeium').setup(${helpers.toLuaObject setupOptions})
tools = {
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
languageServer = helpers.mkNullOrOption types.str ''
The path to the language server downloaded from the official source.
'';
};
wrapper = helpers.mkNullOrOption types.str ''
The path to a wrapper script/binary that is used to execute any binaries not listed under
tools.
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
codeium server.
'';
};
config = mkIf cfg.enable {
extraConfigLua =
let
setupOptions =
with cfg;
{
config_path = configPath;
bin_path = binPath;
api = with api; {
inherit host;
port = if isInt port then toString port else port;
};
tools = with tools; {
inherit
uname
uuidgen
curl
gzip
;
language_server = languageServer;
};
inherit wrapper;
}
// cfg.extraOptions;
in
''
require('codeium').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,63 +4,58 @@
config,
...
}:
with lib; let
with lib;
let
copilot-lua-cfg = config.plugins.copilot-lua;
cfg = config.plugins.copilot-cmp;
in {
options.plugins.copilot-cmp =
helpers.neovim-plugin.extraOptionsOptions
// {
event =
helpers.defaultNullOpts.mkNullable
(with types; listOf str)
''["InsertEnter" "LspAttach"]''
in
{
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
event =
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
''
Configures when the source is registered.
Unless you have a unique problem for your particular configuration you probably don't want
to touch this.
'';
fixPairs = helpers.defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
fixPairs = helpers.defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
This is not good behavior for consistency reasons and will just end up deleting the two ending
characters.
This option fixes that.
Don't turn this off unless you are having problems with pairs and believe this might be
causing them.
'';
};
This is not good behavior for consistency reasons and will just end up deleting the two ending
characters.
This option fixes that.
Don't turn this off unless you are having problems with pairs and believe this might be
causing them.
'';
};
config = mkIf cfg.enable {
warnings =
optional
((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled)
''
optional ((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled) ''
It is recommended to disable copilot's `suggestion` module, as it can interfere with
completions properly appearing in copilot-cmp.
''
++ optional
(
(!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled
)
''
++ optional ((!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled) ''
It is recommended to disable copilot's `panel` module, as it can interfere with completions
properly appearing in copilot-cmp.
'';
plugins.copilot-lua.enable = true;
extraConfigLua = let
setupOptions = with cfg;
{
inherit event;
fix_pairs = fixPairs;
}
// cfg.extraOptions;
in ''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
'';
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit event;
fix_pairs = fixPairs;
}
// cfg.extraOptions;
in
''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -4,9 +4,11 @@
config,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.crates-nvim;
in {
in
{
options.plugins.crates-nvim = helpers.neovim-plugin.extraOptionsOptions;
config = mkIf cfg.enable {

View file

@ -5,27 +5,28 @@
pkgs,
...
}:
with lib; let
cmpLib = import ../cmp-helpers.nix {inherit lib config helpers pkgs;};
with lib;
let
cmpLib = import ../cmp-helpers.nix {
inherit
lib
config
helpers
pkgs
;
};
cmpSourcesPluginNames = attrValues (import ../sources.nix);
pluginModules =
map
(
name:
cmpLib.mkCmpSourcePlugin {inherit name;}
)
cmpSourcesPluginNames;
in {
pluginModules = map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
in
{
# For extra cmp plugins
imports =
[
./codeium-nvim.nix
./copilot-cmp.nix
./cmp-fish.nix
./cmp-git.nix
./cmp-tabby.nix
./cmp-tabnine.nix
./crates-nvim.nix
]
++ pluginModules;
imports = [
./codeium-nvim.nix
./copilot-cmp.nix
./cmp-fish.nix
./cmp-git.nix
./cmp-tabby.nix
./cmp-tabnine.nix
./crates-nvim.nix
] ++ pluginModules;
}

View file

@ -5,7 +5,8 @@
pkgs,
...
}:
with lib; let
with lib;
let
keymapsDefinitions = {
clear = {
default = "<C-]>";
@ -34,36 +35,36 @@ with lib; let
};
};
in
helpers.vim-plugin.mkVimPlugin config {
name = "codeium-vim";
originalName = "codeium.vim";
defaultPackage = pkgs.vimPlugins.codeium-vim;
globalPrefix = "codeium_";
helpers.vim-plugin.mkVimPlugin config {
name = "codeium-vim";
originalName = "codeium.vim";
defaultPackage = pkgs.vimPlugins.codeium-vim;
globalPrefix = "codeium_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-02-19: remove 2024-03-19
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"bin"
"filetypes"
"manual"
"noMapTab"
"idleDelay"
"render"
"tabFallback"
"disableBindings"
];
# TODO introduced 2024-02-19: remove 2024-03-19
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"bin"
"filetypes"
"manual"
"noMapTab"
"idleDelay"
"render"
"tabFallback"
"disableBindings"
];
settingsOptions = {
bin = mkOption {
type = with types; nullOr str;
default = "${pkgs.codeium}/bin/codeium_language_server";
description = "The path to the codeium language server executable.";
};
settingsOptions = {
bin = mkOption {
type = with types; nullOr str;
default = "${pkgs.codeium}/bin/codeium_language_server";
description = "The path to the codeium language server executable.";
};
filetypes =
helpers.defaultNullOpts.mkAttrsOf types.bool
filetypes =
helpers.defaultNullOpts.mkAttrsOf types.bool
''
{
help = false;
@ -77,65 +78,61 @@ in
This can be used to opt out of completions for certain filetypes.
'';
manual = helpers.defaultNullOpts.mkBool false ''
If true, codeium completions will never automatically trigger.
'';
manual = helpers.defaultNullOpts.mkBool false ''
If true, codeium completions will never automatically trigger.
'';
no_map_tab = helpers.defaultNullOpts.mkBool false ''
Whether to disable the `<Tab>` keybinding.
'';
no_map_tab = helpers.defaultNullOpts.mkBool false ''
Whether to disable the `<Tab>` keybinding.
'';
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
Delay in milliseconds before autocompletions are shown (limited by language server to a
minimum of 75).
'';
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
Delay in milliseconds before autocompletions are shown (limited by language server to a
minimum of 75).
'';
render = helpers.defaultNullOpts.mkBool true ''
A global boolean flag that controls whether codeium renders are enabled or disabled.
'';
render = helpers.defaultNullOpts.mkBool true ''
A global boolean flag that controls whether codeium renders are enabled or disabled.
'';
tab_fallback = helpers.mkNullOrOption types.str ''
The fallback key when there is no suggestion display in `codeium#Accept()`.
tab_fallback = helpers.mkNullOrOption types.str ''
The fallback key when there is no suggestion display in `codeium#Accept()`.
Default: "\<C-N>" when a popup menu is visible, else "\t".
'';
Default: "\<C-N>" when a popup menu is visible, else "\t".
'';
disable_bindings = helpers.defaultNullOpts.mkBool false ''
Whether to disable default keybindings.
'';
};
disable_bindings = helpers.defaultNullOpts.mkBool false ''
Whether to disable default keybindings.
'';
};
extraOptions = {
keymaps =
mapAttrs
(
extraOptions = {
keymaps = mapAttrs (
optionName: v:
helpers.defaultNullOpts.mkStr v.default ''
${v.description}
Command: `${v.command}`
''
) keymapsDefinitions;
};
extraConfig = cfg: {
plugins.codeium-vim.settings.enabled = true;
keymaps =
let
processKeymap =
optionName: v:
helpers.defaultNullOpts.mkStr v.default ''
${v.description}
Command: `${v.command}`
''
)
keymapsDefinitions;
};
extraConfig = cfg: {
plugins.codeium-vim.settings.enabled = true;
keymaps = let
processKeymap = optionName: v:
optional
(v != null)
{
optional (v != null) {
key = v;
action = let
inherit (keymapsDefinitions.${optionName}) command;
in
action =
let
inherit (keymapsDefinitions.${optionName}) command;
in
helpers.mkRaw "function() ${command} end";
};
keymapsList = flatten (
mapAttrsToList processKeymap cfg.keymaps
);
keymapsList = flatten (mapAttrsToList processKeymap cfg.keymaps);
defaults = {
mode = "i";
@ -145,8 +142,6 @@ in
};
};
in
helpers.keymaps.mkKeymaps
defaults
keymapsList;
};
}
helpers.keymaps.mkKeymaps defaults keymapsList;
};
}

View file

@ -5,13 +5,16 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.copilot-lua;
in {
in
{
options = {
plugins.copilot-lua = let
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [false]) str);
in
plugins.copilot-lua =
let
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str);
in
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "copilot.lua";
@ -36,9 +39,18 @@ in {
};
layout = {
position = helpers.defaultNullOpts.mkEnum ["bottom" "top" "left" "right"] "bottom" ''
The panel position.
'';
position =
helpers.defaultNullOpts.mkEnum
[
"bottom"
"top"
"left"
"right"
]
"bottom"
''
The panel position.
'';
ratio = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.4" ''
The panel ratio.
@ -69,52 +81,51 @@ in {
};
filetypes =
helpers.defaultNullOpts.mkNullable
(with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
''
{
yaml = false;
markdown = false;
help = false;
gitcommit = false;
gitrebase = false;
hgcommit = false;
svn = false;
cvs = false;
"." = false;
}
''
''
Specify filetypes for attaching copilot.
Each value can be either a boolean or a lua function that returns a boolean.
Example:
```nix
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
''
{
markdown = true; # overrides default
terraform = false; # disallow specific filetype
sh.__raw = \'\'
function ()
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
-- disable for .env files
return false
yaml = false;
markdown = false;
help = false;
gitcommit = false;
gitrebase = false;
hgcommit = false;
svn = false;
cvs = false;
"." = false;
}
''
''
Specify filetypes for attaching copilot.
Each value can be either a boolean or a lua function that returns a boolean.
Example:
```nix
{
markdown = true; # overrides default
terraform = false; # disallow specific filetype
sh.__raw = \'\'
function ()
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
-- disable for .env files
return false
end
return true
end
return true
end
\'\';
}
```
\'\';
}
```
The key `"*"` can be used to disable the default configuration.
Example:
```nix
{
javascript = true; # allow specific filetype
typescript = true; # allow specific filetype
"*" = false; # disable for all other filetypes and ignore default `filetypes`
}
```
'';
The key `"*"` can be used to disable the default configuration.
Example:
```nix
{
javascript = true; # allow specific filetype
typescript = true; # allow specific filetype
"*" = false; # disable for all other filetypes and ignore default `filetypes`
}
```
'';
copilotNodeCommand = mkOption {
type = types.str;
@ -164,41 +175,44 @@ in {
}
];
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = let
setupOptions = with cfg;
{
panel = with panel; {
inherit enabled;
auto_refresh = autoRefresh;
keymap = with keymap; {
jump_prev = jumpPrev;
jump_next = jumpNext;
inherit accept refresh open;
extraConfigLua =
let
setupOptions =
with cfg;
{
panel = with panel; {
inherit enabled;
auto_refresh = autoRefresh;
keymap = with keymap; {
jump_prev = jumpPrev;
jump_next = jumpNext;
inherit accept refresh open;
};
layout = with layout; {
inherit position ratio;
};
};
layout = with layout; {
inherit position ratio;
suggestion = with suggestion; {
inherit enabled;
auto_trigger = autoTrigger;
inherit debounce;
keymap = with keymap; {
inherit accept;
accept_word = acceptWord;
accept_line = acceptLine;
inherit next prev dismiss;
};
};
};
suggestion = with suggestion; {
inherit enabled;
auto_trigger = autoTrigger;
inherit debounce;
keymap = with keymap; {
inherit accept;
accept_word = acceptWord;
accept_line = acceptLine;
inherit next prev dismiss;
};
};
inherit filetypes;
copilot_node_command = copilotNodeCommand;
server_opts_overrides = serverOptsOverrides;
}
// cfg.extraOptions;
in ''
require('copilot').setup(${helpers.toLuaObject setupOptions})
'';
inherit filetypes;
copilot_node_command = copilotNodeCommand;
server_opts_overrides = serverOptsOverrides;
}
// cfg.extraOptions;
in
''
require('copilot').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -7,79 +7,79 @@
}:
with lib;
with helpers.vim-plugin;
helpers.vim-plugin.mkVimPlugin config {
name = "copilot-vim";
originalName = "copilot.vim";
defaultPackage = pkgs.vimPlugins.copilot-vim;
globalPrefix = "copilot_";
helpers.vim-plugin.mkVimPlugin config {
name = "copilot-vim";
originalName = "copilot.vim";
defaultPackage = pkgs.vimPlugins.copilot-vim;
globalPrefix = "copilot_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"nodeCommand"
"filetypes"
"proxy"
];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"nodeCommand"
"filetypes"
"proxy"
];
settingsOptions = {
node_command = mkOption {
type = with types; nullOr str;
default = "${pkgs.nodejs-18_x}/bin/node";
description = "Tell Copilot what `node` binary to use.";
};
filetypes = mkOption {
type = with types; nullOr (attrsOf bool);
default = null;
description = "A dictionary mapping file types to their enabled status.";
example = {
"*" = false;
python = true;
};
};
proxy = mkOption {
type = with types; nullOr str;
default = null;
description = ''
Tell Copilot what proxy server to use.
If this is not set, Copilot will use the value of environment variables like
`$HTTPS_PROXY`.
'';
example = "localhost:3128";
};
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
with GitHub Copilot.
To work around this, SSL certificate verification can be disabled by setting this option to
`false`.
You can also tell `Node.js` to disable SSL verification by setting the
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
'';
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
A list of "workspace folders" or project roots that Copilot may use to improve to improve
the quality of suggestions.
Example: ["~/Projects/myproject"]
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
added automatically.
'';
settingsOptions = {
node_command = mkOption {
type = with types; nullOr str;
default = "${pkgs.nodejs-18_x}/bin/node";
description = "Tell Copilot what `node` binary to use.";
};
settingsExample = {
filetypes = {
filetypes = mkOption {
type = with types; nullOr (attrsOf bool);
default = null;
description = "A dictionary mapping file types to their enabled status.";
example = {
"*" = false;
python = true;
};
proxy = "localhost:3128";
proxy_strict_ssl = false;
workspace_folders = ["~/Projects/myproject"];
};
}
proxy = mkOption {
type = with types; nullOr str;
default = null;
description = ''
Tell Copilot what proxy server to use.
If this is not set, Copilot will use the value of environment variables like
`$HTTPS_PROXY`.
'';
example = "localhost:3128";
};
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
with GitHub Copilot.
To work around this, SSL certificate verification can be disabled by setting this option to
`false`.
You can also tell `Node.js` to disable SSL verification by setting the
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
'';
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
A list of "workspace folders" or project roots that Copilot may use to improve to improve
the quality of suggestions.
Example: ["~/Projects/myproject"]
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
added automatically.
'';
};
settingsExample = {
filetypes = {
"*" = false;
python = true;
};
proxy = "localhost:3128";
proxy_strict_ssl = false;
workspace_folders = [ "~/Projects/myproject" ];
};
}

View file

@ -5,40 +5,44 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.coq-thirdparty;
in {
in
{
options.plugins.coq-thirdparty = {
enable = mkEnableOption "coq-thirdparty";
package = helpers.mkPackageOption "coq-thirdparty" pkgs.vimPlugins.coq-thirdparty;
sources = mkOption {
type = types.listOf (types.submodule {
freeformType = types.attrs;
type = types.listOf (
types.submodule {
freeformType = types.attrs;
options = {
src = mkOption {
type = types.str;
description = "The name of the source";
};
options = {
src = mkOption {
type = types.str;
description = "The name of the source";
};
short_name = mkOption {
type = types.nullOr types.str;
description = ''
A short name for the source.
If not specified, it is uppercase `src`.
'';
example = "nLUA";
default = null;
short_name = mkOption {
type = types.nullOr types.str;
description = ''
A short name for the source.
If not specified, it is uppercase `src`.
'';
example = "nLUA";
default = null;
};
};
};
});
}
);
description = ''
List of sources.
Each source is a free-form type, so additional settings like `accept_key` may be specified even if they are not declared by nixvim.
'';
default = [];
default = [ ];
example = [
{
src = "nvimlua";
@ -53,13 +57,13 @@ in {
short_name = "COP";
accept_key = "<c-f>";
}
{src = "demo";}
{ src = "demo"; }
];
};
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('coq_3p')(${helpers.toLuaObject cfg.sources})

View file

@ -6,78 +6,87 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "coq-nvim";
originalName = "coq_nvim";
defaultPackage = pkgs.vimPlugins.coq_nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "coq-nvim";
originalName = "coq_nvim";
defaultPackage = pkgs.vimPlugins.coq_nvim;
maintainers = [maintainers.traxys helpers.maintainers.Kareem-Medhat];
maintainers = [
maintainers.traxys
helpers.maintainers.Kareem-Medhat
];
extraOptions = {
installArtifacts = mkEnableOption "and install coq-artifacts";
artifactsPackage = mkOption {
type = types.package;
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
default = pkgs.vimPlugins.coq-artifacts;
};
extraOptions = {
installArtifacts = mkEnableOption "and install coq-artifacts";
artifactsPackage = mkOption {
type = types.package;
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
default = pkgs.vimPlugins.coq-artifacts;
};
};
# TODO: Introduced 12-03-2022, remove 12-05-2022
optionsRenamedToSettings = [
"xdg"
"autoStart"
];
imports = let
basePath = ["plugins" "coq-nvim"];
settingsPath = basePath ++ ["settings"];
in [
(
mkRenamedOptionModule
(basePath ++ ["recommendedKeymaps"])
(settingsPath ++ ["keymap" "recommended"])
)
(
mkRenamedOptionModule
(basePath ++ ["alwaysComplete"])
(settingsPath ++ ["completion" "always"])
)
];
callSetup = false;
settingsOptions = {
auto_start =
helpers.mkNullOrOption
(with helpers.nixvimTypes; maybeRaw (either bool (enum ["shut-up"])))
"Auto-start or shut up";
xdg = mkOption {
type = types.bool;
default = true;
description = "Use XDG paths. May be required when installing coq with Nix.";
};
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
};
extraConfig = cfg: {
extraPlugins = mkIf cfg.installArtifacts [
cfg.artifactsPackage
# TODO: Introduced 12-03-2022, remove 12-05-2022
optionsRenamedToSettings = [
"xdg"
"autoStart"
];
imports =
let
basePath = [
"plugins"
"coq-nvim"
];
settingsPath = basePath ++ [ "settings" ];
in
[
(mkRenamedOptionModule (basePath ++ [ "recommendedKeymaps" ]) (
settingsPath
++ [
"keymap"
"recommended"
]
))
globals = {
coq_settings = cfg.settings;
};
(mkRenamedOptionModule (basePath ++ [ "alwaysComplete" ]) (
settingsPath
++ [
"completion"
"always"
]
))
];
extraConfigLua = "require('coq')";
callSetup = false;
settingsOptions = {
auto_start = helpers.mkNullOrOption (
with helpers.nixvimTypes; maybeRaw (either bool (enum [ "shut-up" ]))
) "Auto-start or shut up";
plugins.lsp = {
preConfig = ''
local coq = require 'coq'
'';
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
};
xdg = mkOption {
type = types.bool;
default = true;
description = "Use XDG paths. May be required when installing coq with Nix.";
};
}
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
};
extraConfig = cfg: {
extraPlugins = mkIf cfg.installArtifacts [ cfg.artifactsPackage ];
globals = {
coq_settings = cfg.settings;
};
extraConfigLua = "require('coq')";
plugins.lsp = {
preConfig = ''
local coq = require 'coq'
'';
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
};
};
}

View file

@ -5,85 +5,86 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.lspkind;
in {
options.plugins.lspkind =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "lspkind.nvim";
in
{
options.plugins.lspkind = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "lspkind.nvim";
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
mode =
helpers.defaultNullOpts.mkEnum
["text" "text_symbol" "symbol_text" "symbol"]
"symbol_text"
"Defines how annotations are shown";
mode = helpers.defaultNullOpts.mkEnum [
"text"
"text_symbol"
"symbol_text"
"symbol"
] "symbol_text" "Defines how annotations are shown";
preset = helpers.defaultNullOpts.mkEnum ["default" "codicons"] "codicons" "Default symbol map";
preset = helpers.defaultNullOpts.mkEnum [
"default"
"codicons"
] "codicons" "Default symbol map";
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
cmp = {
enable = mkOption {
type = types.bool;
default = true;
description = "Integrate with nvim-cmp";
};
maxWidth =
helpers.mkNullOrOption types.int
"Maximum number of characters to show in the popup";
ellipsisChar =
helpers.mkNullOrOption types.str
"Character to show when the popup exceeds maxwidth";
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
after =
helpers.mkNullOrOption types.str
"Function to run after calculating the formatting. function(entry, vim_item, kind)";
cmp = {
enable = mkOption {
type = types.bool;
default = true;
description = "Integrate with nvim-cmp";
};
};
config = let
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
options =
{
inherit (cfg) mode preset;
symbol_map = cfg.symbolMap;
}
// (
if doCmp
then {
maxwidth = cfg.cmp.maxWidth;
ellipsis_char = cfg.cmp.ellipsisChar;
inherit (cfg.cmp) menu;
maxWidth = helpers.mkNullOrOption types.int "Maximum number of characters to show in the popup";
ellipsisChar = helpers.mkNullOrOption types.str "Character to show when the popup exceeds maxwidth";
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
after = helpers.mkNullOrOption types.str "Function to run after calculating the formatting. function(entry, vim_item, kind)";
};
};
config =
let
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
options =
{
inherit (cfg) mode preset;
symbol_map = cfg.symbolMap;
}
else {}
)
// cfg.extraOptions;
in
// (
if doCmp then
{
maxwidth = cfg.cmp.maxWidth;
ellipsis_char = cfg.cmp.ellipsisChar;
inherit (cfg.cmp) menu;
}
else
{ }
)
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = optionalString (!doCmp) ''
require('lspkind').init(${helpers.toLuaObject options})
'';
plugins.cmp.settings.formatting.format =
if cfg.cmp.after != null
then ''
function(entry, vim_item)
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
if cfg.cmp.after != null then
''
function(entry, vim_item)
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
return (${cfg.cmp.after})(entry, vim_after, kind)
end
''
else ''
require('lspkind').cmp_format(${helpers.toLuaObject options})
'';
return (${cfg.cmp.after})(entry, vim_after, kind)
end
''
else
''
require('lspkind').cmp_format(${helpers.toLuaObject options})
'';
};
}

View file

@ -5,10 +5,12 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.dap.extensions.dap-go;
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
in {
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
in
{
options.plugins.dap.extensions.dap-go = {
enable = mkEnableOption "dap-go";
@ -22,7 +24,9 @@ in {
delve = {
path = helpers.defaultNullOpts.mkStr "dlv" "The path to the executable dlv which will be used for debugging.";
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 20 "Time to wait for delve to initialize the debug session.";
initializeTimeoutSec =
helpers.defaultNullOpts.mkInt 20
"Time to wait for delve to initialize the debug session.";
port = helpers.defaultNullOpts.mkStr "$\{port}" ''
A string that defines the port to start delve debugger.
@ -36,19 +40,20 @@ in {
};
};
config = let
options = with cfg; {
dap_configurations = dapConfigurations;
config =
let
options = with cfg; {
dap_configurations = dapConfigurations;
delve = with delve; {
inherit path port args;
initialize_timeout_sec = initializeTimeoutSec;
build_flags = buildFlags;
delve = with delve; {
inherit path port args;
initialize_timeout_sec = initializeTimeoutSec;
build_flags = buildFlags;
};
};
};
in
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.dap = {
enable = true;

View file

@ -5,22 +5,28 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.dap.extensions.dap-python;
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
in {
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
in
{
options.plugins.dap.extensions.dap-python = {
enable = mkEnableOption "dap-python";
package = helpers.mkPackageOption "dap-python" pkgs.vimPlugins.nvim-dap-python;
adapterPythonPath = mkOption {
default = "${pkgs.python3.withPackages (ps: with ps; [debugpy])}/bin/python3";
default = "${pkgs.python3.withPackages (ps: with ps; [ debugpy ])}/bin/python3";
description = "Path to the python interpreter. Path must be absolute or in $PATH and needs to have the debugpy package installed.";
type = types.str;
};
console = helpers.defaultNullOpts.mkEnumFirstDefault ["integratedTerminal" "internalConsole" "externalTerminal"] "Debugpy console.";
console = helpers.defaultNullOpts.mkEnumFirstDefault [
"integratedTerminal"
"internalConsole"
"externalTerminal"
] "Debugpy console.";
customConfigurations = helpers.mkNullOrOption (types.listOf dapHelpers.configurationOption) "Custom python configurations for dap.";
@ -46,30 +52,27 @@ in {
'';
};
config = let
options = with cfg; {
inherit console;
include_configs = includeConfigs;
};
in
config =
let
options = with cfg; {
inherit console;
include_configs = includeConfigs;
};
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.dap = {
enable = true;
extensionConfigLua = with helpers;
extensionConfigLua =
with helpers;
''
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject options})
''
+ (optionalString (cfg.testRunners != null) ''
table.insert(require("dap-python").test_runners,
${
toLuaObject
(
builtins.mapAttrs (_: mkRaw) cfg.testRunners
)
})
${toLuaObject (builtins.mapAttrs (_: mkRaw) cfg.testRunners)})
'')
+ (optionalString (cfg.customConfigurations != null) ''
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})

View file

@ -5,20 +5,19 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.dap.extensions.dap-ui;
mkSizeOption =
helpers.mkNullOrOption
(
with types;
either int (numbers.between 0.0 1.0)
);
mkSizeOption = helpers.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
mkKeymapOptions = name:
mkKeymapOptions =
name:
mapAttrs (
key: default:
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${default}" "Map `${key}` for ${name}"
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${
default
}" "Map `${key}` for ${name}"
);
elementOption = types.submodule {
@ -32,7 +31,7 @@ with lib; let
layoutOption = types.submodule {
options = {
elements = mkOption {
default = [];
default = [ ];
description = "Elements to display in this layout.";
type = with types; listOf (either str elementOption);
};
@ -46,178 +45,185 @@ with lib; let
position = mkOption {
default = "left";
description = "Which side of editor to open layout on.";
type = types.enum ["left" "right" "top" "bottom"];
type = types.enum [
"left"
"right"
"top"
"bottom"
];
};
};
};
in {
options.plugins.dap.extensions.dap-ui =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "dap-ui";
in
{
options.plugins.dap.extensions.dap-ui = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "dap-ui";
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
controls = {
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
controls = {
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
element =
helpers.defaultNullOpts.mkEnumFirstDefault ["repl" "scopes" "stacks" "watches" "breakpoints" "console"]
"Element to show the controls on.";
icons = {
disconnect = helpers.defaultNullOpts.mkStr "" "";
pause = helpers.defaultNullOpts.mkStr "" "";
play = helpers.defaultNullOpts.mkStr "" "";
run_last = helpers.defaultNullOpts.mkStr "" "";
step_into = helpers.defaultNullOpts.mkStr "" "";
step_over = helpers.defaultNullOpts.mkStr "" "";
step_out = helpers.defaultNullOpts.mkStr "" "";
step_back = helpers.defaultNullOpts.mkStr "" "";
terminate = helpers.defaultNullOpts.mkStr "" "";
};
};
elementMappings = helpers.mkNullOrOption (
types.attrsOf (
types.submodule {
options = mkKeymapOptions "element mapping overrides" {
edit = "e";
expand = ''["<CR>" "<2-LeftMouse>"]'';
open = "o";
remove = "d";
repl = "r";
toggle = "t";
};
}
)
) "Per-element overrides of global mappings.";
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
floating = {
maxHeight = mkSizeOption "Maximum height of the floating window.";
maxWidth = mkSizeOption "Maximum width of the floating window.";
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
mappings =
helpers.mkNullOrOption (types.submodule {
options = mkKeymapOptions "dap-ui floating" {
close = ''["<ESC>" "q"]'';
};
})
"Keys to trigger actions in elements.";
};
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
element = helpers.defaultNullOpts.mkEnumFirstDefault [
"repl"
"scopes"
"stacks"
"watches"
"breakpoints"
"console"
] "Element to show the controls on.";
icons = {
collapsed = helpers.defaultNullOpts.mkStr "" "";
current_frame = helpers.defaultNullOpts.mkStr "" "";
expanded = helpers.defaultNullOpts.mkStr "" "";
disconnect = helpers.defaultNullOpts.mkStr "" "";
pause = helpers.defaultNullOpts.mkStr "" "";
play = helpers.defaultNullOpts.mkStr "" "";
run_last = helpers.defaultNullOpts.mkStr "" "";
step_into = helpers.defaultNullOpts.mkStr "" "";
step_over = helpers.defaultNullOpts.mkStr "" "";
step_out = helpers.defaultNullOpts.mkStr "" "";
step_back = helpers.defaultNullOpts.mkStr "" "";
terminate = helpers.defaultNullOpts.mkStr "" "";
};
layouts =
helpers.defaultNullOpts.mkNullable (types.listOf layoutOption)
''
```nix
[
{
elements = [
{
id = "scopes";
size = 0.25;
}
{
id = "breakpoints";
size = 0.25;
}
{
id = "stacks";
size = 0.25;
}
{
id = "watches";
size = 0.25;
}
];
position = "left";
size = 40;
}
{
elements = [
{
id = "repl";
size = 0.5;
}
{
id = "console";
size = 0.5;
}
];
position = "bottom";
size = 10;
}
];
```
''
"List of layouts for dap-ui.";
mappings =
helpers.mkNullOrOption (types.submodule {
options = mkKeymapOptions "dap-ui" {
edit = "e";
expand = ''["<CR>" "<2-LeftMouse>"]'';
open = "o";
remove = "d";
repl = "r";
toggle = "t";
};
})
"Keys to trigger actions in elements.";
render = {
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
maxValueLines = helpers.defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
};
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
A function which returns a window to be used for opening buffers such as a stack frame location.
'';
};
config = let
options = with cfg;
{
inherit controls icons layouts mappings;
element_mappings = elementMappings;
floating = with floating; {
inherit border mappings;
max_height = maxHeight;
max_width = maxWidth;
elementMappings = helpers.mkNullOrOption (types.attrsOf (
types.submodule {
options = mkKeymapOptions "element mapping overrides" {
edit = "e";
expand = ''["<CR>" "<2-LeftMouse>"]'';
open = "o";
remove = "d";
repl = "r";
toggle = "t";
};
force_buffers = forceBuffers;
render = with render; {
inherit indent;
max_type_length = maxTypeLength;
max_value_lines = maxValueLines;
};
select_window = selectWindow;
}
// cfg.extraOptions;
in
)) "Per-element overrides of global mappings.";
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
floating = {
maxHeight = mkSizeOption "Maximum height of the floating window.";
maxWidth = mkSizeOption "Maximum width of the floating window.";
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
mappings = helpers.mkNullOrOption (types.submodule {
options = mkKeymapOptions "dap-ui floating" { close = ''["<ESC>" "q"]''; };
}) "Keys to trigger actions in elements.";
};
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
icons = {
collapsed = helpers.defaultNullOpts.mkStr "" "";
current_frame = helpers.defaultNullOpts.mkStr "" "";
expanded = helpers.defaultNullOpts.mkStr "" "";
};
layouts = helpers.defaultNullOpts.mkNullable (types.listOf layoutOption) ''
```nix
[
{
elements = [
{
id = "scopes";
size = 0.25;
}
{
id = "breakpoints";
size = 0.25;
}
{
id = "stacks";
size = 0.25;
}
{
id = "watches";
size = 0.25;
}
];
position = "left";
size = 40;
}
{
elements = [
{
id = "repl";
size = 0.5;
}
{
id = "console";
size = 0.5;
}
];
position = "bottom";
size = 10;
}
];
```
'' "List of layouts for dap-ui.";
mappings = helpers.mkNullOrOption (types.submodule {
options = mkKeymapOptions "dap-ui" {
edit = "e";
expand = ''["<CR>" "<2-LeftMouse>"]'';
open = "o";
remove = "d";
repl = "r";
toggle = "t";
};
}) "Keys to trigger actions in elements.";
render = {
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
maxValueLines =
helpers.defaultNullOpts.mkInt 100
"Maximum number of lines to allow a value to fill before trimming.";
};
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
A function which returns a window to be used for opening buffers such as a stack frame location.
'';
};
config =
let
options =
with cfg;
{
inherit
controls
icons
layouts
mappings
;
element_mappings = elementMappings;
floating = with floating; {
inherit border mappings;
max_height = maxHeight;
max_width = maxWidth;
};
force_buffers = forceBuffers;
render = with render; {
inherit indent;
max_type_length = maxTypeLength;
max_value_lines = maxValueLines;
};
select_window = selectWindow;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.dap = {
enable = true;

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.dap.extensions.dap-virtual-text;
in {
in
{
options.plugins.dap.extensions.dap-virtual-text = {
enable = mkEnableOption "dap-virtual-text";
@ -61,26 +63,27 @@ in {
'';
};
config = let
options = with cfg; {
inherit commented;
config =
let
options = with cfg; {
inherit commented;
enabled_commands = enabledCommands;
highlight_changed_variables = highlightChangedVariables;
highlight_new_as_changed = highlightNewAsChanged;
show_stop_reason = showStopReason;
only_first_definition = onlyFirstDefinition;
all_references = allReferences;
clear_on_continue = clearOnContinue;
display_callback = displayCallback;
virt_text_pos = virtTextPos;
all_frames = allFrames;
virt_lines = virtLines;
virt_text_win_col = virtTextWinCol;
};
in
enabled_commands = enabledCommands;
highlight_changed_variables = highlightChangedVariables;
highlight_new_as_changed = highlightNewAsChanged;
show_stop_reason = showStopReason;
only_first_definition = onlyFirstDefinition;
all_references = allReferences;
clear_on_continue = clearOnContinue;
display_callback = displayCallback;
virt_text_pos = virtTextPos;
all_frames = allFrames;
virt_lines = virtLines;
virt_text_win_col = virtTextWinCol;
};
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
plugins.dap = {
enable = true;

View file

@ -1,40 +1,37 @@
{
lib,
helpers,
}:
with lib; rec {
mkAdapterType = attrs:
{ lib, helpers }:
with lib;
rec {
mkAdapterType =
attrs:
types.submodule {
options =
{
id = helpers.mkNullOrOption types.str ''
Identifier of the adapter. This is used for the
`adapterId` property of the initialize request.
For most debug adapters setting this is not necessary.
options = {
id = helpers.mkNullOrOption types.str ''
Identifier of the adapter. This is used for the
`adapterId` property of the initialize request.
For most debug adapters setting this is not necessary.
'';
enrichConfig = helpers.mkNullOrLuaFn ''
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
configuration with additional information. It receives a configuration as first
argument, and a callback that must be called with the final configuration as second argument.
'';
options = {
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
How many seconds the client waits for a response on a initialize request before emitting a warning.
'';
enrichConfig = helpers.mkNullOrLuaFn ''
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
configuration with additional information. It receives a configuration as first
argument, and a callback that must be called with the final configuration as second argument.
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
How many seconds the client waits for a disconnect response from the debug
adapter before emitting a warning and closing the connection.
'';
options = {
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
How many seconds the client waits for a response on a initialize request before emitting a warning.
'';
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
How many seconds the client waits for a disconnect response from the debug
adapter before emitting a warning and closing the connection.
'';
sourceFiletype = helpers.mkNullOrOption types.str ''
The filetype to use for content retrieved via a source request.
'';
};
}
// attrs;
sourceFiletype = helpers.mkNullOrOption types.str ''
The filetype to use for content retrieved via a source request.
'';
};
} // attrs;
};
executableAdapterOption = mkAdapterType {
@ -54,7 +51,7 @@ with lib; rec {
serverAdapterOption = mkAdapterType {
host = helpers.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
port = helpers.mkNullOrOption (types.either types.int (types.enum ["$\{port}"])) ''
port = helpers.mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
Port to connect to.
If "$\{port}" dap resolves a free port.
This is intended to be used with `executable.args`.
@ -76,7 +73,8 @@ with lib; rec {
'';
};
mkAdapterOption = name: type:
mkAdapterOption =
name: type:
helpers.mkNullOrOption (with types; attrsOf (either str type)) ''
Debug adapters of `${name}` type.
The adapters can also be set to a function which takes three arguments:
@ -100,7 +98,10 @@ with lib; rec {
};
request = mkOption {
type = types.enum ["attach" "launch"];
type = types.enum [
"attach"
"launch"
];
description = ''
Indicates whether the debug adapter should launch a debuggee or attach to one that is already running.
'';
@ -120,18 +121,20 @@ with lib; rec {
numhl = helpers.mkNullOrOption types.str "`numhl` for sign.";
};
processAdapters = type: adapters:
processAdapters =
type: adapters:
with builtins;
mapAttrs (_: adapter:
if isString adapter
then helpers.mkRaw adapter
else
filterAttrs (n: _: n != "enrichConfig") (
adapter
// {
inherit type;
enrich_config = adapter.enrichConfig;
}
))
adapters;
mapAttrs (
_: adapter:
if isString adapter then
helpers.mkRaw adapter
else
filterAttrs (n: _: n != "enrichConfig") (
adapter
// {
inherit type;
enrich_config = adapter.enrichConfig;
}
)
) adapters;
}

View file

@ -5,70 +5,70 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.dap;
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
in
with dapHelpers; {
imports = [
./dap-go.nix
./dap-python.nix
./dap-ui.nix
./dap-virtual-text.nix
];
with dapHelpers;
{
imports = [
./dap-go.nix
./dap-python.nix
./dap-ui.nix
./dap-virtual-text.nix
];
options.plugins.dap =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "dap";
options.plugins.dap = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "dap";
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
adapters = helpers.mkCompositeOption "Dap adapters." {
executables = mkAdapterOption "executable" executableAdapterOption;
servers = mkAdapterOption "server" serverAdapterOption;
};
adapters = helpers.mkCompositeOption "Dap adapters." {
executables = mkAdapterOption "executable" executableAdapterOption;
servers = mkAdapterOption "server" serverAdapterOption;
};
configurations = helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption)) ''
configurations =
helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
''
Debuggee configurations, see `:h dap-configuration` for more info.
'';
signs = helpers.mkCompositeOption "Signs for dap." {
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
signs = helpers.mkCompositeOption "Signs for dap." {
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
dapLogPoint = mkSignOption "L" "Sign for log points.";
dapLogPoint = mkSignOption "L" "Sign for log points.";
dapStopped = mkSignOption "" "Sign to indicate where the debuggee is stopped.";
dapStopped = mkSignOption "" "Sign to indicate where the debuggee is stopped.";
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
};
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
};
extensionConfigLua = mkOption {
type = types.lines;
description = ''
Extension configuration for dap. Don't use this directly !
'';
default = "";
internal = true;
};
};
extensionConfigLua = mkOption {
type = types.lines;
description = ''
Extension configuration for dap. Don't use this directly !
'';
default = "";
internal = true;
};
};
config = let
options = with cfg;
config =
let
options =
with cfg;
{
inherit configurations;
adapters =
(
lib.optionalAttrs (adapters.executables != null)
(processAdapters "executable" adapters.executables)
)
// (
lib.optionalAttrs (adapters.servers != null)
(processAdapters "server" adapters.servers)
);
(lib.optionalAttrs (adapters.executables != null) (
processAdapters "executable" adapters.executables
))
// (lib.optionalAttrs (adapters.servers != null) (processAdapters "server" adapters.servers));
signs = with signs; {
DapBreakpoint = dapBreakpoint;
@ -80,22 +80,22 @@ in
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfigLua =
(optionalString (cfg.adapters != null) ''
require("dap").adapters = ${helpers.toLuaObject options.adapters}
'')
+ (optionalString (options.configurations != null) ''
require("dap").configurations = ${helpers.toLuaObject options.configurations}
'')
+ (optionalString (cfg.signs != null) ''
local __dap_signs = ${helpers.toLuaObject options.signs}
for sign_name, sign in pairs(__dap_signs) do
vim.fn.sign_define(sign_name, sign)
end
'')
+ cfg.extensionConfigLua;
};
}
extraConfigLua =
(optionalString (cfg.adapters != null) ''
require("dap").adapters = ${helpers.toLuaObject options.adapters}
'')
+ (optionalString (options.configurations != null) ''
require("dap").configurations = ${helpers.toLuaObject options.configurations}
'')
+ (optionalString (cfg.signs != null) ''
local __dap_signs = ${helpers.toLuaObject options.signs}
for sign_name, sign in pairs(__dap_signs) do
vim.fn.sign_define(sign_name, sign)
end
'')
+ cfg.extensionConfigLua;
};
}

View file

@ -5,92 +5,100 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.chadtree;
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in {
options.plugins.chadtree =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "chadtree";
in
{
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "chadtree";
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
options = {
follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents.
options = {
follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents.
'';
lang = helpers.mkNullOrOption types.str ''
CHADTree will guess your locale from unix environmental variables.
Set to `c` to disable emojis.
'';
mimetypes = {
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
Show a warning before opening these datatypes.
'';
lang = helpers.mkNullOrOption types.str ''
CHADTree will guess your locale from unix environmental variables.
Set to `c` to disable emojis.
allowExts = mkListStr ''[".ts"]'' ''
Skip warning for these extensions.
'';
mimetypes = {
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
Show a warning before opening these datatypes.
'';
allowExts = mkListStr ''[".ts"]'' ''
Skip warning for these extensions.
'';
};
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
Change how many lines `{` and `}` scroll.
'';
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
CHADTree's background refresh rate.
'';
session = helpers.defaultNullOpts.mkBool true ''
Save & restore currently open folders.
'';
showHidden = helpers.defaultNullOpts.mkBool false ''
Hide some files and folders by default. By default this can be toggled using the `.` key.
see `chadtree_settings.ignore` for more details.
'';
versionControl = helpers.defaultNullOpts.mkBool true ''
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
'';
ignore = {
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
Files whose name match these exactly will be ignored.
'';
nameGlob = mkListStr "[]" ''
Files whose name match these glob patterns will be ignored.
ie. `*.py` will match all python files
'';
pathGlob = mkListStr "[]" ''
Files whose full path match these glob patterns will be ignored.
'';
};
};
view = {
openDirection = helpers.defaultNullOpts.mkEnum ["left" "right"] "left" ''
Which way does CHADTree open?
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
Change how many lines `{` and `}` scroll.
'';
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
CHADTree's background refresh rate.
'';
session = helpers.defaultNullOpts.mkBool true ''
Save & restore currently open folders.
'';
showHidden = helpers.defaultNullOpts.mkBool false ''
Hide some files and folders by default. By default this can be toggled using the `.` key.
see `chadtree_settings.ignore` for more details.
'';
versionControl = helpers.defaultNullOpts.mkBool true ''
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
'';
ignore = {
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
Files whose name match these exactly will be ignored.
'';
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
CHADTree can sort by the following criterion.
Reorder them if you want a different sorting order.
legal keys: some of
`["is_folder" "ext" "file_name"]`
nameGlob = mkListStr "[]" ''
Files whose name match these glob patterns will be ignored.
ie. `*.py` will match all python files
'';
width = helpers.defaultNullOpts.mkInt 40 ''
How big is CHADTree when initially opened?
pathGlob = mkListStr "[]" ''
Files whose full path match these glob patterns will be ignored.
'';
};
};
windowOptions =
helpers.defaultNullOpts.mkAttributeSet ''
view = {
openDirection =
helpers.defaultNullOpts.mkEnum
[
"left"
"right"
]
"left"
''
Which way does CHADTree open?
'';
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
CHADTree can sort by the following criterion.
Reorder them if you want a different sorting order.
legal keys: some of
`["is_folder" "ext" "file_name"]`
'';
width = helpers.defaultNullOpts.mkInt 40 ''
How big is CHADTree when initially opened?
'';
windowOptions =
helpers.defaultNullOpts.mkAttributeSet
''
{
cursorline = true;
number = false;
@ -103,34 +111,44 @@ in {
''
Set of window local options to for CHADTree windows.
'';
};
};
theme = {
highlights = {
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
These are used for files that are ignored by user supplied pattern
in `chadtree.ignore` and by version control.
'';
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
These are used to show bookmarks.
'';
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
These are used to notify the number of times a file / folder appears in the `quickfix` list.
'';
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
These are used to put a version control status beside each file.
'';
};
iconGlyphSet = helpers.defaultNullOpts.mkEnum ["devicons" "emoji" "ascii" "ascii_hollow"] "devicons" ''
Icon glyph set to use.
theme = {
highlights = {
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
These are used for files that are ignored by user supplied pattern
in `chadtree.ignore` and by version control.
'';
textColourSet =
helpers.defaultNullOpts.mkEnum [
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
These are used to show bookmarks.
'';
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
These are used to notify the number of times a file / folder appears in the `quickfix` list.
'';
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
These are used to put a version control status beside each file.
'';
};
iconGlyphSet =
helpers.defaultNullOpts.mkEnum
[
"devicons"
"emoji"
"ascii"
"ascii_hollow"
]
"devicons"
''
Icon glyph set to use.
'';
textColourSet =
helpers.defaultNullOpts.mkEnum
[
"env"
"solarized_dark_256"
"solarized_dark"
@ -140,7 +158,9 @@ in {
"trapdoor"
"nerdtree_syntax_light"
"nerdtree_syntax_dark"
] "env" ''
]
"env"
''
On `unix`, the command `ls` can produce coloured results based on the `LS_COLORS` environmental variable.
CHADTree can pretend it's `ls` by setting `chadtree.theme.textColourSet` to `env`.
@ -148,282 +168,294 @@ in {
If you are not happy with that, you can choose one of the many others.
'';
iconColourSet = helpers.defaultNullOpts.mkEnum ["github" "none"] "github" ''
Right now you all the file icons are coloured according to Github colours.
iconColourSet =
helpers.defaultNullOpts.mkEnum
[
"github"
"none"
]
"github"
''
Right now you all the file icons are coloured according to Github colours.
You may also disable colouring if you wish.
You may also disable colouring if you wish.
'';
};
keymap = {
windowManagement = {
quit = mkListStr ''["q"]'' ''
Close CHADTree window, quit if it is the last window.
'';
bigger = mkListStr ''["+" "="]'' ''
Resize CHADTree window bigger.
'';
smaller = mkListStr ''["-" "_"]'' ''
Resize CHADTree window smaller.
'';
refresh = mkListStr ''["<c-r>"]'' ''
Refresh CHADTree.
'';
};
keymap = {
windowManagement = {
quit = mkListStr ''["q"]'' ''
Close CHADTree window, quit if it is the last window.
'';
rerooting = {
changeDir = mkListStr ''["b"]'' ''
Change vim's working directory.
'';
bigger = mkListStr ''["+" "="]'' ''
Resize CHADTree window bigger.
'';
changeFocus = mkListStr ''["c"]'' ''
Set CHADTree's root to folder at cursor. Does not change working directory.
'';
smaller = mkListStr ''["-" "_"]'' ''
Resize CHADTree window smaller.
'';
changeFocusUp = mkListStr ''["C"]'' ''
Set CHADTree's root one level up.
'';
};
refresh = mkListStr ''["<c-r>"]'' ''
Refresh CHADTree.
'';
};
openFileFolder = {
primary = mkListStr ''["<enter>"]'' ''
Open file at cursor.
'';
rerooting = {
changeDir = mkListStr ''["b"]'' ''
Change vim's working directory.
'';
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
Open file at cursor, keep cursor in CHADTree's window.
'';
changeFocus = mkListStr ''["c"]'' ''
Set CHADTree's root to folder at cursor. Does not change working directory.
'';
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
Open file at cursor in a new tab.
'';
changeFocusUp = mkListStr ''["C"]'' ''
Set CHADTree's root one level up.
'';
};
vSplit = mkListStr ''["w"]'' ''
Open file at cursor in vertical split.
'';
openFileFolder = {
primary = mkListStr ''["<enter>"]'' ''
Open file at cursor.
'';
hSplit = mkListStr ''["W"]'' ''
Open file at cursor in horizontal split.
'';
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
Open file at cursor, keep cursor in CHADTree's window.
'';
openSys = mkListStr ''["o"]'' ''
Open file with GUI tools using `open` or `xdg open`.
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
Depends on platform and user setup.
'';
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
Open file at cursor in a new tab.
'';
collapse = mkListStr ''["o"]'' ''
Collapse all subdirectories for directory at cursor.
'';
};
vSplit = mkListStr ''["w"]'' ''
Open file at cursor in vertical split.
'';
cursor = {
refocus = mkListStr ''["~"]'' ''
Put cursor at the root of CHADTree.
'';
hSplit = mkListStr ''["W"]'' ''
Open file at cursor in horizontal split.
'';
jumpToCurrent = mkListStr ''["J"]'' ''
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
'';
openSys = mkListStr ''["o"]'' ''
Open file with GUI tools using `open` or `xdg open`.
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
Depends on platform and user setup.
'';
stat = mkListStr ''["K"]'' ''
Print `ls --long` stat for file under cursor.
'';
collapse = mkListStr ''["o"]'' ''
Collapse all subdirectories for directory at cursor.
'';
};
copyName = mkListStr ''["y"]'' ''
Copy paths of files under cursor or visual block.
'';
cursor = {
refocus = mkListStr ''["~"]'' ''
Put cursor at the root of CHADTree.
'';
copyBasename = mkListStr ''["Y"]'' ''
Copy names of files under cursor or visual block.
'';
jumpToCurrent = mkListStr ''["J"]'' ''
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
'';
copyRelname = mkListStr ''["<c-y>"]'' ''
Copy relative paths of files under cursor or visual block.
'';
};
stat = mkListStr ''["K"]'' ''
Print `ls --long` stat for file under cursor.
'';
filtering = {
filter = mkListStr ''["f"]'' ''
Set a glob pattern to narrow down visible files.
'';
copyName = mkListStr ''["y"]'' ''
Copy paths of files under cursor or visual block.
'';
clearFilter = mkListStr ''["F"]'' ''
Clear filter.
'';
};
copyBasename = mkListStr ''["Y"]'' ''
Copy names of files under cursor or visual block.
'';
bookmarks = {
bookmarkGoto = mkListStr ''["m"]'' ''
Goto bookmark `A-Z`.
'';
};
copyRelname = mkListStr ''["<c-y>"]'' ''
Copy relative paths of files under cursor or visual block.
'';
};
selecting = {
select = mkListStr ''["s"]'' ''
Select files under cursor or visual block.
'';
filtering = {
filter = mkListStr ''["f"]'' ''
Set a glob pattern to narrow down visible files.
'';
clearSelection = mkListStr ''["S"]'' ''
Clear selection.
'';
};
clearFilter = mkListStr ''["F"]'' ''
Clear filter.
'';
};
fileOperations = {
new = mkListStr ''["a"]'' ''
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
bookmarks = {
bookmarkGoto = mkListStr ''["m"]'' ''
Goto bookmark `A-Z`.
'';
};
Intermediary folders are created automatically.
selecting = {
select = mkListStr ''["s"]'' ''
Select files under cursor or visual block.
'';
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
'';
clearSelection = mkListStr ''["S"]'' ''
Clear selection.
'';
};
link = mkListStr ''["A"]'' ''
Create links at location under cursor from selection.
fileOperations = {
new = mkListStr ''["a"]'' ''
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
Links are always relative.
Intermediary folders are created automatically.
Intermediary folders are created automatically.
'';
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
'';
rename = mkListStr ''["r"]'' ''
Rename file under cursor.
'';
link = mkListStr ''["A"]'' ''
Create links at location under cursor from selection.
toggleExec = mkListStr ''["X"]'' ''
Toggle all the `+x` bits of the selected / highlighted files.
Links are always relative.
Except for directories, where `-x` will prevent reading.
'';
Intermediary folders are created automatically.
'';
copy = mkListStr ''["p"]'' ''
Copy the selected files to location under cursor.
'';
rename = mkListStr ''["r"]'' ''
Rename file under cursor.
'';
cut = mkListStr ''["x"]'' ''
Move the selected files to location under cursor.
'';
toggleExec = mkListStr ''["X"]'' ''
Toggle all the `+x` bits of the selected / highlighted files.
delete = mkListStr ''["d"]'' ''
Delete the selected files. Items deleted cannot be recovered.
'';
Except for directories, where `-x` will prevent reading.
'';
trash = mkListStr ''[t]'' ''
Trash the selected files using platform specific `trash` command, if they are available.
Items trashed may be recovered.
'';
};
copy = mkListStr ''["p"]'' ''
Copy the selected files to location under cursor.
'';
toggles = {
toggleHidden = mkListStr ''["."]'' ''
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
'';
cut = mkListStr ''["x"]'' ''
Move the selected files to location under cursor.
'';
toggleFollow = mkListStr ''["u"]'' ''
Toggle `follow` on and off. See `chadtree.follow` for details.
'';
delete = mkListStr ''["d"]'' ''
Delete the selected files. Items deleted cannot be recovered.
'';
trash = mkListStr ''[t]'' ''
Trash the selected files using platform specific `trash` command, if they are available.
Items trashed may be recovered.
'';
};
toggles = {
toggleHidden = mkListStr ''["."]'' ''
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
'';
toggleFollow = mkListStr ''["u"]'' ''
Toggle `follow` on and off. See `chadtree.follow` for details.
'';
toggleVersionControl = mkListStr ''["i"]'' ''
Toggle version control integration on and off.
'';
};
toggleVersionControl = mkListStr ''["i"]'' ''
Toggle version control integration on and off.
'';
};
};
};
config = let
setupOptions = with cfg; {
xdg = true;
options = with options; {
inherit follow;
inherit lang;
mimetypes = with mimetypes; {
inherit warn;
allow_exts = allowExts;
};
page_increment = pageIncrement;
polling_rate = pollingRate;
inherit session;
show_hidden = showHidden;
version_control = versionControl;
ignore = with ignore; {
name_exact = nameExact;
name_glob = nameGlob;
path_glob = pathGlob;
};
};
view = with view; {
open_direction = openDirection;
sort_by = sortBy;
inherit width;
window_options = windowOptions;
};
theme = with theme; {
highlights = with highlights; {
inherit ignored;
inherit bookmarks;
inherit quickfix;
config =
let
setupOptions = with cfg; {
xdg = true;
options = with options; {
inherit follow;
inherit lang;
mimetypes = with mimetypes; {
inherit warn;
allow_exts = allowExts;
};
page_increment = pageIncrement;
polling_rate = pollingRate;
inherit session;
show_hidden = showHidden;
version_control = versionControl;
ignore = with ignore; {
name_exact = nameExact;
name_glob = nameGlob;
path_glob = pathGlob;
};
};
icon_glyph_set = iconGlyphSet;
text_colour_set = textColourSet;
icon_colour_set = iconColourSet;
view = with view; {
open_direction = openDirection;
sort_by = sortBy;
inherit width;
window_options = windowOptions;
};
theme = with theme; {
highlights = with highlights; {
inherit ignored;
inherit bookmarks;
inherit quickfix;
version_control = versionControl;
};
icon_glyph_set = iconGlyphSet;
text_colour_set = textColourSet;
icon_colour_set = iconColourSet;
};
keymap =
with keymap;
with windowManagement;
with rerooting;
with openFileFolder;
with cursor;
with filtering;
with bookmarks;
with selecting;
with fileOperations;
with toggles;
{
inherit quit;
inherit bigger;
inherit smaller;
inherit refresh;
change_dir = changeDir;
change_focus = changeFocus;
change_focus_up = changeFocusUp;
inherit primary;
inherit secondary;
inherit tertiary;
v_split = vSplit;
h_split = hSplit;
open_sys = openSys;
inherit collapse;
inherit refocus;
jump_to_current = jumpToCurrent;
inherit stat;
copy_name = copyName;
copy_basename = copyBasename;
copy_relname = copyRelname;
inherit filter;
clear_filter = clearFilter;
bookmark_goto = bookmarkGoto;
inherit select;
clear_selection = clearSelection;
inherit new;
inherit link;
inherit rename;
toggle_exec = toggleExec;
inherit copy;
inherit cut;
inherit delete;
inherit trash;
toggle_hidden = toggleHidden;
toggle_follow = toggleFollow;
toggle_version_control = toggleVersionControl;
};
};
keymap = with keymap;
with windowManagement;
with rerooting;
with openFileFolder;
with cursor;
with filtering;
with bookmarks;
with selecting;
with fileOperations;
with toggles; {
inherit quit;
inherit bigger;
inherit smaller;
inherit refresh;
change_dir = changeDir;
change_focus = changeFocus;
change_focus_up = changeFocusUp;
inherit primary;
inherit secondary;
inherit tertiary;
v_split = vSplit;
h_split = hSplit;
open_sys = openSys;
inherit collapse;
inherit refocus;
jump_to_current = jumpToCurrent;
inherit stat;
copy_name = copyName;
copy_basename = copyBasename;
copy_relname = copyRelname;
inherit filter;
clear_filter = clearFilter;
bookmark_goto = bookmarkGoto;
inherit select;
clear_selection = clearSelection;
inherit new;
inherit link;
inherit rename;
toggle_exec = toggleExec;
inherit copy;
inherit cut;
inherit delete;
inherit trash;
toggle_hidden = toggleHidden;
toggle_follow = toggleFollow;
toggle_version_control = toggleVersionControl;
};
};
in
in
mkIf cfg.enable {
extraPlugins =
[cfg.package]
++ (optional (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") pkgs.vimPlugins.nvim-web-devicons);
[ cfg.package ]
++ (optional (
cfg.theme == null || cfg.theme.iconGlyphSet == "devicons"
) pkgs.vimPlugins.nvim-web-devicons);
extraConfigLua = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
originalName = "committia.vim";
defaultPackage = pkgs.vimPlugins.committia-vim;
globalPrefix = "committia_";
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
maintainers = [helpers.maintainers.alisonjenkins];
maintainers = [ helpers.maintainers.alisonjenkins ];
settingsOptions = {
open_only_vim_starting = helpers.defaultNullOpts.mkBool true ''

File diff suppressed because it is too large Load diff

View file

@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
name = "fugitive";
originalName = "vim-fugitive";
defaultPackage = pkgs.vimPlugins.vim-fugitive;
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
# In typical tpope fashion, this plugin has no config options
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.git-worktree;
in {
in
{
options = {
plugins.git-worktree = {
enable = mkEnableOption "git-worktree";
@ -43,16 +45,17 @@ in {
};
};
config = let
setupOptions = with cfg; {
enabled = cfg.enable;
change_directory_command = cfg.changeDirectoryCommand;
update_on_change = cfg.updateOnChange;
update_on_change_command = cfg.updateOnChangeCommand;
clearjumps_on_change = cfg.clearJumpsOnChange;
inherit autopush;
};
in
config =
let
setupOptions = with cfg; {
enabled = cfg.enable;
change_directory_command = cfg.changeDirectoryCommand;
update_on_change = cfg.updateOnChange;
update_on_change_command = cfg.updateOnChangeCommand;
clearjumps_on_change = cfg.clearJumpsOnChange;
inherit autopush;
};
in
mkIf cfg.enable {
assertions = [
{
@ -66,17 +69,15 @@ in {
plenary-nvim
];
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
extraConfigLua = let
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
in ''
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
${
if cfg.enableTelescope
then telescopeCfg
else ""
}
'';
extraConfigLua =
let
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
in
''
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
${if cfg.enableTelescope then telescopeCfg else ""}
'';
};
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.gitblame;
in {
in
{
options = {
plugins.gitblame = {
enable = mkEnableOption "gitblame";
@ -22,40 +24,47 @@ in {
highlightGroup = helpers.defaultNullOpts.mkStr "Comment" "The highlight group for virtual text.";
displayVirtualText = helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true) "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
displayVirtualText =
helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true)
"If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString []) "A list of filetypes for which gitblame information will not be displayed.";
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString
[ ]
) "A list of filetypes for which gitblame information will not be displayed.";
delay = helpers.defaultNullOpts.mkUnsignedInt 0 "The delay in milliseconds after which the blame info will be displayed.";
delay =
helpers.defaultNullOpts.mkUnsignedInt 0
"The delay in milliseconds after which the blame info will be displayed.";
virtualTextColumn = helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null) "Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
virtualTextColumn =
helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null)
"Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
extmarkOptions = helpers.defaultNullOpts.mkAttributeSet (toString null) "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)";
};
};
config = let
setupOptions = {
enabled = cfg.enable;
message_template = cfg.messageTemplate;
date_format = cfg.dateFormat;
message_when_not_committed = cfg.messageWhenNotCommitted;
highlight_group = cfg.highlightGroup;
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
if cfg.displayVirtualText
then 1
else 0
);
ignored_filetypes = cfg.ignoredFiletypes;
inherit (cfg) delay;
virtual_text_column = cfg.virtualTextColumn;
set_extmark_options = cfg.extmarkOptions;
};
in
config =
let
setupOptions = {
enabled = cfg.enable;
message_template = cfg.messageTemplate;
date_format = cfg.dateFormat;
message_when_not_committed = cfg.messageWhenNotCommitted;
highlight_group = cfg.highlightGroup;
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
if cfg.displayVirtualText then 1 else 0
);
ignored_filetypes = cfg.ignoredFiletypes;
inherit (cfg) delay;
virtual_text_column = cfg.virtualTextColumn;
set_extmark_options = cfg.extmarkOptions;
};
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
extraConfigLua = ''
require('gitblame').setup${helpers.toLuaObject setupOptions}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.gitgutter;
in {
in
{
options = {
plugins.gitgutter = {
enable = mkEnableOption "gitgutter";
@ -57,14 +59,16 @@ in {
};
signs = mkOption {
type = let
signOption = desc:
mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
};
in
type =
let
signOption =
desc:
mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
};
in
types.submodule {
options = {
added = signOption "added lines";
@ -76,7 +80,7 @@ in {
modifiedRemoved = signOption "modified and removed lines";
};
};
default = {};
default = { };
description = "Custom signs for the sign column";
};
@ -99,22 +103,24 @@ in {
};
grep = mkOption {
type = types.nullOr (types.oneOf [
(types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
type = types.nullOr (
types.oneOf [
(types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
};
};
};
})
types.str
]);
})
types.str
]
);
default = null;
description = "A non-standard grep to use instead of the default";
};
@ -169,25 +175,20 @@ in {
};
};
config = let
grepPackage =
if builtins.isAttrs cfg.grep
then [cfg.grep.package]
else [];
grepCommand =
if builtins.isAttrs cfg.grep
then cfg.grep.command
else cfg.grep;
in
config =
let
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
opts = mkIf cfg.recommendedSettings {
updatetime = 100;
foldtext = "gitgutter#fold#foldtext";
};
extraPackages = [pkgs.git] ++ grepPackage;
extraPackages = [ pkgs.git ] ++ grepPackage;
globals = {
gitgutter_max_signs = mkIf (cfg.maxSigns != null) cfg.maxSigns;
@ -200,8 +201,12 @@ in {
gitgutter_sign_added = mkIf (cfg.signs.added != null) cfg.signs.added;
gitgutter_sign_modified = mkIf (cfg.signs.modified != null) cfg.signs.modified;
gitgutter_sign_removed = mkIf (cfg.signs.removed != null) cfg.signs.removed;
gitgutter_sign_removed_first_line = mkIf (cfg.signs.removedFirstLine != null) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (cfg.signs.removedAboveAndBelow != null) cfg.signs.removedAboveAndBelow;
gitgutter_sign_removed_first_line = mkIf (
cfg.signs.removedFirstLine != null
) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (
cfg.signs.removedAboveAndBelow != null
) cfg.signs.removedAboveAndBelow;
gitgutter_sign_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";

View file

@ -8,61 +8,58 @@
with lib;
# We use `mkVimPlugin` to avoid having a `settings` option.
# Indeed, this plugin is not configurable in the common sense (no `setup` function).
helpers.vim-plugin.mkVimPlugin config {
name = "gitignore";
originalName = "gitignore.nvim";
defaultPackage = pkgs.vimPlugins.gitignore-nvim;
helpers.vim-plugin.mkVimPlugin config {
name = "gitignore";
originalName = "gitignore.nvim";
defaultPackage = pkgs.vimPlugins.gitignore-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraOptions = {
keymap = mkOption {
type = with types;
nullOr
(
either
str
(submodule {
options = {
key = mkOption {
type = str;
description = "The key to map.";
example = "<leader>gi";
};
mode = helpers.keymaps.mkModeOption "n";
options = helpers.keymaps.mapConfigOptions;
extraOptions = {
keymap = mkOption {
type =
with types;
nullOr (
either str (submodule {
options = {
key = mkOption {
type = str;
description = "The key to map.";
example = "<leader>gi";
};
})
);
default = null;
description = ''
Keyboard shortcut for the `gitignore.generate` command.
Can be:
- A string: which key to bind
- An attrs: if you want to customize the mode and/or the options of the keymap
(`desc`, `silent`, ...)
'';
example = "<leader>gi";
};
};
extraConfig = cfg: {
keymaps =
optional (cfg.keymap != null)
(
(
if isString cfg.keymap
then {
mode = "n";
key = cfg.keymap;
}
else cfg.keymap
)
// {
action.__raw = "require('gitignore').generate";
}
mode = helpers.keymaps.mkModeOption "n";
options = helpers.keymaps.mapConfigOptions;
};
})
);
default = null;
description = ''
Keyboard shortcut for the `gitignore.generate` command.
Can be:
- A string: which key to bind
- An attrs: if you want to customize the mode and/or the options of the keymap
(`desc`, `silent`, ...)
'';
example = "<leader>gi";
};
}
};
extraConfig = cfg: {
keymaps = optional (cfg.keymap != null) (
(
if isString cfg.keymap then
{
mode = "n";
key = cfg.keymap;
}
else
cfg.keymap
)
// {
action.__raw = "require('gitignore').generate";
}
);
};
}

View file

@ -5,22 +5,21 @@
pkgs,
...
}:
with lib; {
options.plugins.gitlinker =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "gitlinker.nvim";
with lib;
{
options.plugins.gitlinker = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "gitlinker.nvim";
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
Adds current line nr in the url for normal mode.
'';
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
Adds current line nr in the url for normal mode.
'';
actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
"copy_to_clipboard"
''
Callback for what to do with the url.
@ -35,21 +34,12 @@ with lib; {
- Raw lua code `actionCallback.__raw = "function() ... end";`.
'';
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
callbacks =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf
(
either
str
helpers.nixvimTypes.rawLua
)
)
callbacks =
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
''
{
"github.com" = "get_github_type_url";
@ -77,43 +67,42 @@ with lib; {
Learn more by reading `:h gitinker-callbacks`.
'';
};
};
config = let
cfg = config.plugins.gitlinker;
in
config =
let
cfg = config.plugins.gitlinker;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = let
setupOptions = with cfg;
{
opts = {
inherit remote;
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
action_callback =
if isString actionCallback
then helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
else actionCallback;
print_url = printUrl;
inherit mappings;
};
callbacks =
helpers.ifNonNull' callbacks
(
mapAttrs
(
extraConfigLua =
let
setupOptions =
with cfg;
{
opts = {
inherit remote;
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
action_callback =
if isString actionCallback then
helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
else
actionCallback;
print_url = printUrl;
inherit mappings;
};
callbacks = helpers.ifNonNull' callbacks (
mapAttrs (
source: callback:
if isString callback
then helpers.mkRaw "require('gitlinker.hosts').${callback}"
else callback
)
callbacks
if isString callback then helpers.mkRaw "require('gitlinker.hosts').${callback}" else callback
) callbacks
);
}
// cfg.extraOptions;
in ''
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
'';
}
// cfg.extraOptions;
in
''
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -5,8 +5,9 @@
pkgs,
...
}:
with lib; {
meta.maintainers = [maintainers.traxys];
with lib;
{
meta.maintainers = [ maintainers.traxys ];
options.plugins.gitmessenger = {
enable = mkEnableOption "gitmessenger";
@ -17,20 +18,23 @@ with lib; {
A popup window is no longer closed automatically when moving a cursor after the window is
shown up.
'';
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "current" "all"] ''
When this value is not set to "none", a popup window includes diff hunks of the commit at
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
all diff hunks in the commit.
includeDiff =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"none"
"current"
"all"
]
''
When this value is not set to "none", a popup window includes diff hunks of the commit at
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
all diff hunks in the commit.
Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this
value is set to "none".
'';
gitCommand =
helpers.defaultNullOpts.mkStr "git"
"git command to retrieve commit messages.";
noDefaultMappings =
helpers.defaultNullOpts.mkBool false
"When this value is set, it does not define any key mappings";
Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this
value is set to "none".
'';
gitCommand = helpers.defaultNullOpts.mkStr "git" "git command to retrieve commit messages.";
noDefaultMappings = helpers.defaultNullOpts.mkBool false "When this value is set, it does not define any key mappings";
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
showing a popup does not move the cursor in the window.
@ -92,11 +96,12 @@ with lib; {
'';
};
config = let
cfg = config.plugins.gitmessenger;
in
config =
let
cfg = config.plugins.gitmessenger;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals = {
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
git_messenger_include_diff = cfg.includeDiff;

View file

@ -6,150 +6,319 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "gitsigns";
originalName = "gitsigns.nvim";
defaultPackage = pkgs.vimPlugins.gitsigns-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "gitsigns";
originalName = "gitsigns.nvim";
defaultPackage = pkgs.vimPlugins.gitsigns-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO: introduced 2024-03-12, remove on 2024-05-12
deprecateExtraOptions = true;
optionsRenamedToSettings = [
["signs" "add" "hl"]
["signs" "add" "text"]
["signs" "add" "numhl"]
["signs" "add" "linehl"]
["signs" "add" "showCount"]
["signs" "change" "hl"]
["signs" "change" "text"]
["signs" "change" "numhl"]
["signs" "change" "linehl"]
["signs" "change" "showCount"]
["signs" "topdelete" "hl"]
["signs" "topdelete" "text"]
["signs" "topdelete" "numhl"]
["signs" "topdelete" "linehl"]
["signs" "topdelete" "showCount"]
["signs" "changedelete" "hl"]
["signs" "changedelete" "text"]
["signs" "changedelete" "numhl"]
["signs" "changedelete" "linehl"]
["signs" "changedelete" "showCount"]
["signs" "untracked" "hl"]
["signs" "untracked" "text"]
["signs" "untracked" "numhl"]
["signs" "untracked" "linehl"]
["signs" "untracked" "showCount"]
"worktrees"
"signPriority"
"signcolumn"
# TODO: introduced 2024-03-12, remove on 2024-05-12
deprecateExtraOptions = true;
optionsRenamedToSettings = [
[
"signs"
"add"
"hl"
]
[
"signs"
"add"
"text"
]
[
"signs"
"add"
"numhl"
]
[
"signs"
"add"
"linehl"
"showDeleted"
["diffOpts" "algorithm"]
["diffOpts" "internal"]
["diffOpts" "indentHeuristic"]
["diffOpts" "vertical"]
["diffOpts" "linematch"]
"base"
"countChars"
"maxFileLength"
"previewConfig"
"attachToUntracked"
"updateDebounce"
"currentLineBlame"
["currentLineBlameOpts" "virtText"]
["currentLineBlameOpts" "virtTextPos"]
["currentLineBlameOpts" "delay"]
["currentLineBlameOpts" "ignoreWhitespace"]
["currentLineBlameOpts" "virtTextPriority"]
"trouble"
["yadm" "enable"]
"wordDiff"
"debugMode"
];
imports = let
basePluginPaths = ["plugins" "gitsigns"];
settingsPath = basePluginPaths ++ ["settings"];
in [
(
mkRenamedOptionModule
(basePluginPaths ++ ["onAttach" "function"])
(settingsPath ++ ["on_attach"])
]
[
"signs"
"add"
"showCount"
]
[
"signs"
"change"
"hl"
]
[
"signs"
"change"
"text"
]
[
"signs"
"change"
"numhl"
]
[
"signs"
"change"
"linehl"
]
[
"signs"
"change"
"showCount"
]
[
"signs"
"topdelete"
"hl"
]
[
"signs"
"topdelete"
"text"
]
[
"signs"
"topdelete"
"numhl"
]
[
"signs"
"topdelete"
"linehl"
]
[
"signs"
"topdelete"
"showCount"
]
[
"signs"
"changedelete"
"hl"
]
[
"signs"
"changedelete"
"text"
]
[
"signs"
"changedelete"
"numhl"
]
[
"signs"
"changedelete"
"linehl"
]
[
"signs"
"changedelete"
"showCount"
]
[
"signs"
"untracked"
"hl"
]
[
"signs"
"untracked"
"text"
]
[
"signs"
"untracked"
"numhl"
]
[
"signs"
"untracked"
"linehl"
]
[
"signs"
"untracked"
"showCount"
]
"worktrees"
"signPriority"
"signcolumn"
"numhl"
"linehl"
"showDeleted"
[
"diffOpts"
"algorithm"
]
[
"diffOpts"
"internal"
]
[
"diffOpts"
"indentHeuristic"
]
[
"diffOpts"
"vertical"
]
[
"diffOpts"
"linematch"
]
"base"
"countChars"
"maxFileLength"
"previewConfig"
"attachToUntracked"
"updateDebounce"
"currentLineBlame"
[
"currentLineBlameOpts"
"virtText"
]
[
"currentLineBlameOpts"
"virtTextPos"
]
[
"currentLineBlameOpts"
"delay"
]
[
"currentLineBlameOpts"
"ignoreWhitespace"
]
[
"currentLineBlameOpts"
"virtTextPriority"
]
"trouble"
[
"yadm"
"enable"
]
"wordDiff"
"debugMode"
];
imports =
let
basePluginPaths = [
"plugins"
"gitsigns"
];
settingsPath = basePluginPaths ++ [ "settings" ];
in
[
(mkRenamedOptionModule (
basePluginPaths
++ [
"onAttach"
"function"
]
) (settingsPath ++ [ "on_attach" ]))
(mkRenamedOptionModule
(
basePluginPaths
++ [
"watchGitDir"
"enable"
]
)
(
settingsPath
++ [
"watch_gitdir"
"enable"
]
)
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["watchGitDir" "enable"])
(settingsPath ++ ["watch_gitdir" "enable"])
)
(
mkRemovedOptionModule
(basePluginPaths ++ ["watchGitDir" "interval"])
"The option has been removed from upstream."
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["watchGitDir" "followFiles"])
(settingsPath ++ ["watch_gitdir" "follow_files"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["statusFormatter" "function"])
(settingsPath ++ ["status_formatter"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["currentLineBlameFormatter" "normal"])
(settingsPath ++ ["current_line_blame_formatter"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["currentLineBlameFormatter" "nonCommitted"])
(settingsPath ++ ["current_line_blame_formatter_nc"])
(mkRemovedOptionModule (
basePluginPaths
++ [
"watchGitDir"
"interval"
]
) "The option has been removed from upstream.")
(mkRenamedOptionModule
(
basePluginPaths
++ [
"watchGitDir"
"followFiles"
]
)
(
settingsPath
++ [
"watch_gitdir"
"follow_files"
]
)
)
(mkRenamedOptionModule (
basePluginPaths
++ [
"statusFormatter"
"function"
]
) (settingsPath ++ [ "status_formatter" ]))
(mkRenamedOptionModule (
basePluginPaths
++ [
"currentLineBlameFormatter"
"normal"
]
) (settingsPath ++ [ "current_line_blame_formatter" ]))
(mkRenamedOptionModule (
basePluginPaths
++ [
"currentLineBlameFormatter"
"nonCommitted"
]
) (settingsPath ++ [ "current_line_blame_formatter_nc" ]))
];
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
description = ''
Which package to use for `git`.
Set to `null` to prevent the installation.
'';
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
description = ''
Which package to use for `git`.
Set to `null` to prevent the installation.
'';
};
};
settingsOptions = import ./options.nix {inherit lib helpers;};
settingsOptions = import ./options.nix { inherit lib helpers; };
settingsExample = {
signs = {
add.text = "";
change.text = "";
delete.text = "_";
topdelete.text = "";
changedelete.text = "~";
untracked.text = "";
};
signcolumn = true;
watch_gitdir.follow_files = true;
current_line_blame = false;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
settingsExample = {
signs = {
add.text = "";
change.text = "";
delete.text = "_";
topdelete.text = "";
changedelete.text = "~";
untracked.text = "";
};
signcolumn = true;
watch_gitdir.follow_files = true;
current_line_blame = false;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
};
extraConfig = cfg: {
warnings =
optional
((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
extraConfig = cfg: {
warnings =
optional ((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
''
Nixvim (plugins.gitsigns): You have enabled `plugins.gitsigns.settings.trouble` but
`plugins.trouble.enable` is `false`.
You should maybe enable the `trouble` plugin.
'';
extraPackages = [cfg.gitPackage];
};
}
extraPackages = [ cfg.gitPackage ];
};
}

View file

@ -1,83 +1,80 @@
{ lib, helpers }:
with lib;
{
lib,
helpers,
}:
with lib; {
signs = let
signOptions = defaults: {
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
Specifies the highlight group to use for the sign.
'';
signs =
let
signOptions = defaults: {
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
Specifies the highlight group to use for the sign.
'';
text = helpers.defaultNullOpts.mkStr defaults.text ''
Specifies the character to use for the sign.
'';
text = helpers.defaultNullOpts.mkStr defaults.text ''
Specifies the character to use for the sign.
'';
numhl = helpers.defaultNullOpts.mkStr defaults.numhl ''
Specifies the highlight group to use for the number column.
'';
numhl = helpers.defaultNullOpts.mkStr defaults.numhl ''
Specifies the highlight group to use for the number column.
'';
linehl = helpers.defaultNullOpts.mkStr defaults.linehl ''
Specifies the highlight group to use for the line.
'';
linehl = helpers.defaultNullOpts.mkStr defaults.linehl ''
Specifies the highlight group to use for the line.
'';
show_count = helpers.defaultNullOpts.mkBool false ''
Showing count of hunk, e.g. number of deleted lines.
'';
};
in {
add = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
change = signOptions {
hl = "GitSignsChange";
text = "";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
delete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
topdelete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
changedelete = signOptions {
hl = "GitSignsChange";
text = "~";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
untracked = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
};
worktrees = let
worktreeType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
toplevel = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
};
gitdir = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
};
show_count = helpers.defaultNullOpts.mkBool false ''
Showing count of hunk, e.g. number of deleted lines.
'';
};
in
{
add = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
change = signOptions {
hl = "GitSignsChange";
text = "";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
delete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
topdelete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
changedelete = signOptions {
hl = "GitSignsChange";
text = "~";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
untracked = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
};
in
worktrees =
let
worktreeType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
toplevel = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
gitdir = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
};
};
in
helpers.mkNullOrOption (types.listOf worktreeType) ''
Detached working trees.
If normal attaching fails, then each entry in the table is attempted with the work tree
@ -149,57 +146,63 @@ with lib; {
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
'';
diff_opts = let
diffOptType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
algorithm =
helpers.defaultNullOpts.mkEnumFirstDefault
["myers" "minimal" "patience" "histogram"]
''
Diff algorithm to use. Values:
- "myers" the default algorithm
- "minimal" spend extra time to generate the smallest possible diff
- "patience" patience diff algorithm
- "histogram" histogram diff algorithm
diff_opts =
let
diffOptType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
algorithm =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"myers"
"minimal"
"patience"
"histogram"
]
''
Diff algorithm to use. Values:
- "myers" the default algorithm
- "minimal" spend extra time to generate the smallest possible diff
- "patience" patience diff algorithm
- "histogram" histogram diff algorithm
'';
internal = helpers.defaultNullOpts.mkBool false ''
Use Neovim's built in `xdiff` library for running diffs.
'';
internal = helpers.defaultNullOpts.mkBool false ''
Use Neovim's built in `xdiff` library for running diffs.
'';
indent_heuristic = helpers.defaultNullOpts.mkBool false ''
Use the indent heuristic for the internal diff library.
'';
indent_heuristic = helpers.defaultNullOpts.mkBool false ''
Use the indent heuristic for the internal diff library.
'';
vertical = helpers.defaultNullOpts.mkBool true ''
Start diff mode with vertical splits.
'';
vertical = helpers.defaultNullOpts.mkBool true ''
Start diff mode with vertical splits.
'';
linematch = helpers.mkNullOrOption types.int ''
Enable second-stage diff on hunks to align lines.
Requires `internal=true`.
'';
linematch = helpers.mkNullOrOption types.int ''
Enable second-stage diff on hunks to align lines.
Requires `internal=true`.
'';
ignore_blank_lines = helpers.defaultNullOpts.mkBool true ''
Ignore changes where lines are blank.
'';
ignore_blank_lines = helpers.defaultNullOpts.mkBool true ''
Ignore changes where lines are blank.
'';
ignore_whitespace_change = helpers.defaultNullOpts.mkBool true ''
Ignore changes in amount of white space.
It should ignore adding trailing white space, but not leading white space.
'';
ignore_whitespace_change = helpers.defaultNullOpts.mkBool true ''
Ignore changes in amount of white space.
It should ignore adding trailing white space, but not leading white space.
'';
ignore_whitespace = helpers.defaultNullOpts.mkBool true ''
Ignore all white space changes.
'';
ignore_whitespace = helpers.defaultNullOpts.mkBool true ''
Ignore all white space changes.
'';
ignore_whitespace_change_at_eol = helpers.defaultNullOpts.mkBool true ''
Ignore white space changes at end of line.
'';
ignore_whitespace_change_at_eol = helpers.defaultNullOpts.mkBool true ''
Ignore white space changes at end of line.
'';
};
};
};
in
in
helpers.mkNullOrOption diffOptType ''
Diff options.
If set to null they are derived from the vim `diffopt`.
@ -212,49 +215,46 @@ with lib; {
count_chars =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
"__unkeyed_1" = "1";
"__unkeyed_2" = "2";
"__unkeyed_3" = "3";
"__unkeyed_4" = "4";
"__unkeyed_5" = "5";
"__unkeyed_6" = "6";
"__unkeyed_7" = "7";
"__unkeyed_8" = "8";
"__unkeyed_9" = "9";
"+" = ">";
}
''
''
The count characters used when `signs.*.show_count` is enabled.
The `+` entry is used as a fallback. With the default, any count outside of 1-9 uses the `>`
character in the sign.
''
{
"__unkeyed_1" = "1";
"__unkeyed_2" = "2";
"__unkeyed_3" = "3";
"__unkeyed_4" = "4";
"__unkeyed_5" = "5";
"__unkeyed_6" = "6";
"__unkeyed_7" = "7";
"__unkeyed_8" = "8";
"__unkeyed_9" = "9";
"+" = ">";
}
''
''
The count characters used when `signs.*.show_count` is enabled.
The `+` entry is used as a fallback. With the default, any count outside of 1-9 uses the `>`
character in the sign.
Possible use cases for this field:
- to specify unicode characters for the counts instead of 1-9.
- to define characters to be used for counts greater than 9.
'';
Possible use cases for this field:
- to specify unicode characters for the counts instead of 1-9.
- to define characters to be used for counts greater than 9.
'';
status_formatter =
helpers.defaultNullOpts.mkLuaFn
''
function(status)
local added, changed, removed = status.added, status.changed, status.removed
local status_txt = {}
if added and added > 0 then
table.insert(status_txt, '+' .. added)
end
if changed and changed > 0 then
table.insert(status_txt, '~' .. changed)
end
if removed and removed > 0 then
table.insert(status_txt, '-' .. removed)
end
return table.concat(status_txt, ' ')
status_formatter = helpers.defaultNullOpts.mkLuaFn ''
function(status)
local added, changed, removed = status.added, status.changed, status.removed
local status_txt = {}
if added and added > 0 then
table.insert(status_txt, '+' .. added)
end
''
"Function used to format `b:gitsigns_status`.";
if changed and changed > 0 then
table.insert(status_txt, '~' .. changed)
end
if removed and removed > 0 then
table.insert(status_txt, '-' .. removed)
end
return table.concat(status_txt, ' ')
end
'' "Function used to format `b:gitsigns_status`.";
max_file_length = helpers.defaultNullOpts.mkUnsignedInt 40000 ''
Max file length (in lines) to attach to.
@ -262,19 +262,19 @@ with lib; {
preview_config =
helpers.defaultNullOpts.mkAttrsOf types.anything
''
{
border = "single";
style = "minimal";
relative = "cursor";
row = 0;
col = 1;
}
''
''
Option overrides for the Gitsigns preview window.
Table is passed directly to `nvim_open_win`.
'';
''
{
border = "single";
style = "minimal";
relative = "cursor";
row = 0;
col = 1;
}
''
''
Option overrides for the Gitsigns preview window.
Table is passed directly to `nvim_open_win`.
'';
auto_attach = helpers.defaultNullOpts.mkBool true ''
Automatically attach to files.
@ -298,14 +298,21 @@ with lib; {
Whether to show a virtual text blame annotation
'';
virt_text_pos = helpers.defaultNullOpts.mkEnumFirstDefault ["eol" "overlay" "right_align"] ''
Blame annotation position.
virt_text_pos =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"eol"
"overlay"
"right_align"
]
''
Blame annotation position.
Available values:
- `eol` Right after eol character.
- `overlay` Display over the specified column, without shifting the underlying text.
- `right_align` Display right aligned in the window.
'';
Available values:
- `eol` Right after eol character.
- `overlay` Display over the specified column, without shifting the underlying text.
- `right_align` Display right aligned in the window.
'';
delay = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
Sets the delay (in milliseconds) before blame virtual text is displayed.
@ -320,90 +327,84 @@ with lib; {
'';
};
current_line_blame_formatter =
helpers.defaultNullOpts.mkStr
" <author>, <author_time> - <summary> "
''
String or function used to format the virtual text of `current_line_blame`.
current_line_blame_formatter = helpers.defaultNullOpts.mkStr " <author>, <author_time> - <summary> " ''
String or function used to format the virtual text of `current_line_blame`.
When a string, accepts the following format specifiers:
- `<abbrev_sha>`
- `<orig_lnum>`
- `<final_lnum>`
- `<author>`
- `<author_mail>`
- `<author_time>` or `<author_time:FORMAT>`
- `<author_tz>`
- `<committer>`
- `<committer_mail>`
- `<committer_time>` or `<committer_time:FORMAT>`
- `<committer_tz>`
- `<summary>`
- `<previous>`
- `<filename>`
When a string, accepts the following format specifiers:
- `<abbrev_sha>`
- `<orig_lnum>`
- `<final_lnum>`
- `<author>`
- `<author_mail>`
- `<author_time>` or `<author_time:FORMAT>`
- `<author_tz>`
- `<committer>`
- `<committer_mail>`
- `<committer_time>` or `<committer_time:FORMAT>`
- `<committer_tz>`
- `<summary>`
- `<previous>`
- `<filename>`
For `<author_time:FORMAT>` and `<committer_time:FORMAT>`, `FORMAT` can be any valid date
format that is accepted by `os.date()` with the addition of `%R` (defaults to `%Y-%m-%d`):
- `%a` abbreviated weekday name (e.g., Wed)
- `%A` full weekday name (e.g., Wednesday)
- `%b` abbreviated month name (e.g., Sep)
- `%B` full month name (e.g., September)
- `%c` date and time (e.g., 09/16/98 23:48:10)
- `%d` day of the month (16) [01-31]
- `%H` hour, using a 24-hour clock (23) [00-23]
- `%I` hour, using a 12-hour clock (11) [01-12]
- `%M` minute (48) [00-59]
- `%m` month (09) [01-12]
- `%p` either "am" or "pm" (pm)
- `%S` second (10) [00-61]
- `%w` weekday (3) [0-6 = Sunday-Saturday]
- `%x` date (e.g., 09/16/98)
- `%X` time (e.g., 23:48:10)
- `%Y` full year (1998)
- `%y` two-digit year (98) [00-99]
- `%%` the character `%´
- `%R` relative (e.g., 4 months ago)
For `<author_time:FORMAT>` and `<committer_time:FORMAT>`, `FORMAT` can be any valid date
format that is accepted by `os.date()` with the addition of `%R` (defaults to `%Y-%m-%d`):
- `%a` abbreviated weekday name (e.g., Wed)
- `%A` full weekday name (e.g., Wednesday)
- `%b` abbreviated month name (e.g., Sep)
- `%B` full month name (e.g., September)
- `%c` date and time (e.g., 09/16/98 23:48:10)
- `%d` day of the month (16) [01-31]
- `%H` hour, using a 24-hour clock (23) [00-23]
- `%I` hour, using a 12-hour clock (11) [01-12]
- `%M` minute (48) [00-59]
- `%m` month (09) [01-12]
- `%p` either "am" or "pm" (pm)
- `%S` second (10) [00-61]
- `%w` weekday (3) [0-6 = Sunday-Saturday]
- `%x` date (e.g., 09/16/98)
- `%X` time (e.g., 23:48:10)
- `%Y` full year (1998)
- `%y` two-digit year (98) [00-99]
- `%%` the character `%´
- `%R` relative (e.g., 4 months ago)
When a function:
When a function:
Parameters:
- `{name}` Git user name returned from `git config user.name`
- `{blame_info}` Table with the following keys:
- `abbrev_sha`: string
- `orig_lnum`: integer
- `final_lnum`: integer
- `author`: string
- `author_mail`: string
- `author_time`: integer
- `author_tz`: string
- `committer`: string
- `committer_mail`: string
- `committer_time`: integer
- `committer_tz`: string
- `summary`: string
- `previous`: string
- `filename`: string
- `boundary`: true?
Parameters:
- `{name}` Git user name returned from `git config user.name`
- `{blame_info}` Table with the following keys:
- `abbrev_sha`: string
- `orig_lnum`: integer
- `final_lnum`: integer
- `author`: string
- `author_mail`: string
- `author_time`: integer
- `author_tz`: string
- `committer`: string
- `committer_mail`: string
- `committer_time`: integer
- `committer_tz`: string
- `summary`: string
- `previous`: string
- `filename`: string
- `boundary`: true?
Note that the keys map onto the output of:
`git blame --line-porcelain`
Note that the keys map onto the output of:
`git blame --line-porcelain`
- {opts} Passed directly from `settings.current_line_blame_formatter_opts`.
- {opts} Passed directly from `settings.current_line_blame_formatter_opts`.
Return:
The result of this function is passed directly to the `opts.virt_text` field of
`|nvim_buf_set_extmark|` and thus must be a list of `[text, highlight]` tuples.
'';
Return:
The result of this function is passed directly to the `opts.virt_text` field of
`|nvim_buf_set_extmark|` and thus must be a list of `[text, highlight]` tuples.
'';
current_line_blame_formatter_nc =
helpers.defaultNullOpts.mkStr
" <author>"
''
String or function used to format the virtual text of `|gitsigns-config-current_line_blame|`
for lines that aren't committed.
current_line_blame_formatter_nc = helpers.defaultNullOpts.mkStr " <author>" ''
String or function used to format the virtual text of `|gitsigns-config-current_line_blame|`
for lines that aren't committed.
See `|gitsigns-config-current_line_blame_formatter|` for more information.
'';
See `|gitsigns-config-current_line_blame_formatter|` for more information.
'';
trouble = helpers.mkNullOrOption types.bool ''
When using setqflist() or setloclist(), open Trouble instead of the

View file

@ -6,87 +6,89 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "lazygit";
originalName = "lazygit.nvim";
defaultPackage = pkgs.vimPlugins.lazygit-nvim;
globalPrefix = "lazygit_";
helpers.vim-plugin.mkVimPlugin config {
name = "lazygit";
originalName = "lazygit.nvim";
defaultPackage = pkgs.vimPlugins.lazygit-nvim;
globalPrefix = "lazygit_";
maintainers = [helpers.maintainers.AndresBermeoMarinelli];
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
settingsOptions = {
floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "0" ''
Set the transparency of the floating window.
'';
settingsOptions = {
floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "0" ''
Set the transparency of the floating window.
'';
floating_window_scaling_factor =
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative
"0.9" "Set the scaling factor for floating window.";
floating_window_scaling_factor =
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative "0.9"
"Set the scaling factor for floating window.";
floating_window_border_chars =
helpers.defaultNullOpts.mkListOf types.str
''["" "" "" "" "" "" "" ""]''
floating_window_border_chars =
helpers.defaultNullOpts.mkListOf types.str ''["" "" "" "" "" "" "" ""]''
"Customize lazygit popup window border characters.";
floating_window_use_plenary = helpers.defaultNullOpts.mkBool false ''
Whether to use plenary.nvim to manage floating window if available.
floating_window_use_plenary = helpers.defaultNullOpts.mkBool false ''
Whether to use plenary.nvim to manage floating window if available.
'';
use_neovim_remote = helpers.defaultNullOpts.mkBool true ''
Whether to use neovim remote. Will fallback to `false` if neovim-remote is not installed.
'';
use_custom_config_file_path = helpers.defaultNullOpts.mkBool false ''
Config file path is evaluated if this value is `true`.
'';
config_file_path = helpers.defaultNullOpts.mkNullable (
with types; either str (listOf str)
) "[]" "Custom config file path or list of custom config file paths.";
};
settingsExample = {
floating_window_winblend = 0;
floating_window_scaling_factor = 0.9;
floating_window_border_chars = [
""
""
""
""
""
""
""
""
];
floating_window_use_plenary = false;
use_neovim_remote = true;
use_custom_config_file_path = false;
config_file_path = [ ];
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
example = null;
description = ''
The `git` package to use.
Set to `null` to not install any package.
'';
};
use_neovim_remote = helpers.defaultNullOpts.mkBool true ''
Whether to use neovim remote. Will fallback to `false` if neovim-remote is not installed.
lazygitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
example = null;
description = ''
The `lazygit` package to use.
Set to `null` to not install any package.
'';
use_custom_config_file_path = helpers.defaultNullOpts.mkBool false ''
Config file path is evaluated if this value is `true`.
'';
config_file_path =
helpers.defaultNullOpts.mkNullable
(
with types;
either
str (listOf str)
)
"[]"
"Custom config file path or list of custom config file paths.";
};
};
settingsExample = {
floating_window_winblend = 0;
floating_window_scaling_factor = 0.9;
floating_window_border_chars = ["" "" "" "" "" "" "" ""];
floating_window_use_plenary = false;
use_neovim_remote = true;
use_custom_config_file_path = false;
config_file_path = [];
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
example = null;
description = ''
The `git` package to use.
Set to `null` to not install any package.
'';
};
lazygitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
example = null;
description = ''
The `lazygit` package to use.
Set to `null` to not install any package.
'';
};
};
extraConfig = cfg: {
extraPackages = [
cfg.gitPackage
cfg.lazygitPackage
];
};
}
extraConfig = cfg: {
extraPackages = [
cfg.gitPackage
cfg.lazygitPackage
];
};
}

View file

@ -6,99 +6,124 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "neogit";
defaultPackage = pkgs.vimPlugins.neogit;
extraPackages = [pkgs.git];
helpers.neovim-plugin.mkNeovimPlugin config {
name = "neogit";
defaultPackage = pkgs.vimPlugins.neogit;
extraPackages = [ pkgs.git ];
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-02-29: remove 2024-04-29
deprecateExtraOptions = true;
imports =
map (
# TODO introduced 2024-02-29: remove 2024-04-29
deprecateExtraOptions = true;
imports =
map
(
optionPath:
mkRemovedOptionModule
(["plugins" "neogit"] ++ optionPath)
mkRemovedOptionModule
(
[
"plugins"
"neogit"
]
++ optionPath
)
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
)
[
["disableCommitConfirmation"]
["disableBuiltinNotifications"]
["useMagitKeybindings "]
["commitPopup"]
["sections" "unmerged"]
["sections" "unpulled"]
[ "disableCommitConfirmation" ]
[ "disableBuiltinNotifications" ]
[ "useMagitKeybindings " ]
[ "commitPopup" ]
[
"sections"
"unmerged"
]
[
"sections"
"unpulled"
]
];
optionsRenamedToSettings = [
"disableSigns"
"disableHint"
"disableContextHighlighting"
"autoRefresh"
"graphStyle"
"kind"
"signs"
"integrations"
["sections" "untracked"]
["sections" "unstaged"]
["sections" "staged"]
["sections" "stashes"]
["sections" "recent"]
"mappings"
];
optionsRenamedToSettings = [
"disableSigns"
"disableHint"
"disableContextHighlighting"
"autoRefresh"
"graphStyle"
"kind"
"signs"
"integrations"
[
"sections"
"untracked"
]
[
"sections"
"unstaged"
]
[
"sections"
"staged"
]
[
"sections"
"stashes"
]
[
"sections"
"recent"
]
"mappings"
];
settingsOptions = import ./options.nix {inherit lib helpers;};
settingsOptions = import ./options.nix { inherit lib helpers; };
settingsExample = {
kind = "floating";
commit_popup.kind = "floating";
preview_buffer.kind = "floating";
popup.kind = "floating";
integrations.diffview = false;
disable_commit_confirmation = true;
disable_builtin_notifications = true;
sections = {
untracked.folded = false;
unstaged.folded = false;
staged.folded = false;
stashes.folded = false;
unpulled.folded = false;
unmerged.folded = true;
recent.folded = true;
};
mappings = {
status = {
l = "Toggle";
a = "Stage";
};
settingsExample = {
kind = "floating";
commit_popup.kind = "floating";
preview_buffer.kind = "floating";
popup.kind = "floating";
integrations.diffview = false;
disable_commit_confirmation = true;
disable_builtin_notifications = true;
sections = {
untracked.folded = false;
unstaged.folded = false;
staged.folded = false;
stashes.folded = false;
unpulled.folded = false;
unmerged.folded = true;
recent.folded = true;
};
mappings = {
status = {
l = "Toggle";
a = "Stage";
};
};
};
extraConfig = cfg: {
assertions =
map
(
name: {
assertion = let
extraConfig = cfg: {
assertions =
map
(name: {
assertion =
let
enabled = cfg.settings.integrations.${name};
isEnabled = (isBool enabled) && enabled;
in
isEnabled
-> config.plugins.${name}.enable;
message = ''
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
'';
}
)
isEnabled -> config.plugins.${name}.enable;
message = ''
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
'';
})
[
"telescope"
"diffview"
"fzf-lua"
];
extraPackages =
optional
(hasInfix "which" (cfg.settings.commit_view.verify_commit.__raw or ""))
pkgs.which;
};
}
extraPackages = optional (hasInfix "which" (
cfg.settings.commit_view.verify_commit.__raw or ""
)) pkgs.which;
};
}

View file

@ -1,20 +1,17 @@
{ lib, helpers }:
with lib;
let
mkKindOption = helpers.defaultNullOpts.mkEnum [
"split"
"vsplit"
"split_above"
"tab"
"floating"
"replace"
"auto"
];
in
{
lib,
helpers,
}:
with lib; let
mkKindOption =
helpers.defaultNullOpts.mkEnum
[
"split"
"vsplit"
"split_above"
"tab"
"floating"
"replace"
"auto"
];
in {
filewatcher = {
interval = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
Interval between two refreshes.
@ -26,10 +23,16 @@ in {
'';
};
graph_style = helpers.defaultNullOpts.mkEnumFirstDefault ["ascii" "unicode"] ''
- "ascii" is the graph the git CLI generates
- "unicode" is the graph like https://github.com/rbong/vim-flog
'';
graph_style =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"ascii"
"unicode"
]
''
- "ascii" is the graph the git CLI generates
- "unicode" is the graph like https://github.com/rbong/vim-flog
'';
disable_hint = helpers.defaultNullOpts.mkBool false ''
Hides the hints at the top of the status buffer.
@ -43,16 +46,13 @@ in {
Disables signs for sections/items/hunks.
'';
git_services =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
"github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1";
"bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1";
"gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}";
}
''
"Used to generate URL's for branch popup action 'pull request'.";
git_services = helpers.defaultNullOpts.mkAttrsOf types.str ''
{
"github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1";
"bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1";
"gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}";
}
'' "Used to generate URL's for branch popup action 'pull request'.";
fetch_after_checkout = helpers.defaultNullOpts.mkBool false ''
Perform a fetch if the newly checked out branch has an upstream or pushRemote set.
@ -71,15 +71,13 @@ in {
'';
disable_insert_on_commit =
helpers.defaultNullOpts.mkNullable
(with types; either bool (enum ["auto"]))
"auto"
''
Changes what mode the Commit Editor starts in.
`true` will leave nvim in normal mode, `false` will change nvim to insert mode, and `"auto"`
will change nvim to insert mode IF the commit message is empty, otherwise leaving it in normal
mode.
'';
helpers.defaultNullOpts.mkNullable (with types; either bool (enum [ "auto" ])) "auto"
''
Changes what mode the Commit Editor starts in.
`true` will leave nvim in normal mode, `false` will change nvim to insert mode, and `"auto"`
will change nvim to insert mode IF the commit message is empty, otherwise leaving it in normal
mode.
'';
use_per_project_settings = helpers.defaultNullOpts.mkBool true ''
Scope persisted settings on a per-project basis.
@ -178,24 +176,26 @@ in {
signs =
mapAttrs
(n: v:
helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' ''
The icons to use for open and closed ${n}s.
'')
{
hunk = {
closed = "";
opened = "";
(
n: v:
helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' ''
The icons to use for open and closed ${n}s.
''
)
{
hunk = {
closed = "";
opened = "";
};
item = {
closed = ">";
opened = "v";
};
section = {
closed = ">";
opened = "v";
};
};
item = {
closed = ">";
opened = "v";
};
section = {
closed = ">";
opened = "v";
};
};
integrations = {
telescope = helpers.mkNullOrOption types.bool ''
@ -217,10 +217,11 @@ in {
sections =
mapAttrs
(
name: default:
(
name: default:
mkOption {
type = with types;
type =
with types;
nullOr (submodule {
options = {
folded = mkOption {
@ -237,87 +238,84 @@ in {
inherit default;
description = "Settings for the ${name} section";
}
)
{
sequencer = {
folded = false;
hidden = false;
)
{
sequencer = {
folded = false;
hidden = false;
};
untracked = {
folded = false;
hidden = false;
};
unstaged = {
folded = false;
hidden = false;
};
staged = {
folded = false;
hidden = false;
};
stashes = {
folded = true;
hidden = false;
};
unpulled_upstream = {
folded = true;
hidden = false;
};
unmerged_upstream = {
folded = false;
hidden = false;
};
unpulled_pushRemote = {
folded = true;
hidden = false;
};
unmerged_pushRemote = {
folded = false;
hidden = false;
};
recent = {
folded = true;
hidden = false;
};
rebase = {
folded = true;
hidden = false;
};
};
untracked = {
folded = false;
hidden = false;
};
unstaged = {
folded = false;
hidden = false;
};
staged = {
folded = false;
hidden = false;
};
stashes = {
folded = true;
hidden = false;
};
unpulled_upstream = {
folded = true;
hidden = false;
};
unmerged_upstream = {
folded = false;
hidden = false;
};
unpulled_pushRemote = {
folded = true;
hidden = false;
};
unmerged_pushRemote = {
folded = false;
hidden = false;
};
recent = {
folded = true;
hidden = false;
};
rebase = {
folded = true;
hidden = false;
};
};
ignored_settings =
helpers.defaultNullOpts.mkListOf types.str
''
[
"NeogitPushPopup--force-with-lease"
"NeogitPushPopup--force"
"NeogitPullPopup--rebase"
"NeogitCommitPopup--allow-empty"
"NeogitRevertPopup--no-edit"
]
''
''
Table of settings to never persist.
Uses format "Filetype--cli-value".
'';
mappings = let
mkMappingOption = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [false]));
in {
commit_editor =
mkMappingOption
''
[
"NeogitPushPopup--force-with-lease"
"NeogitPushPopup--force"
"NeogitPullPopup--rebase"
"NeogitCommitPopup--allow-empty"
"NeogitRevertPopup--no-edit"
]
''
''
Table of settings to never persist.
Uses format "Filetype--cli-value".
'';
mappings =
let
mkMappingOption = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ]));
in
{
commit_editor = mkMappingOption ''
{
q = "Close";
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
''
"Mappings for the commit editor.";
'' "Mappings for the commit editor.";
rebase_editor =
mkMappingOption
''
rebase_editor = mkMappingOption ''
{
p = "Pick";
r = "Reword";
@ -334,12 +332,9 @@ in {
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
''
"Mappings for the rebase editor.";
'' "Mappings for the rebase editor.";
finder =
mkMappingOption
''
finder = mkMappingOption ''
{
"<cr>" = "Select";
"<c-c>" = "Close";
@ -352,12 +347,9 @@ in {
"<s-tab>" = "MultiselectTogglePrevious";
"<c-j>" = "NOP";
}
''
"Mappings for the finder.";
'' "Mappings for the finder.";
popup =
mkMappingOption
''
popup = mkMappingOption ''
{
"?" = "HelpPopup";
A = "CherryPickPopup";
@ -375,12 +367,9 @@ in {
r = "RebasePopup";
v = "RevertPopup";
}
''
"Mappings for popups.";
'' "Mappings for popups.";
status =
mkMappingOption
''
status = mkMappingOption ''
{
q = "Close";
I = "InitRepo";
@ -406,9 +395,8 @@ in {
"{" = "GoToPreviousHunkHeader";
"}" = "GoToNextHunkHeader";
}
''
"Mappings for status.";
};
'' "Mappings for status.";
};
notification_icon = helpers.defaultNullOpts.mkStr "󰊢" ''
Icon for notifications.
@ -418,10 +406,9 @@ in {
Set to false if you want to be responsible for creating _ALL_ keymappings.
'';
highlight =
genAttrs ["italic" "bold" "underline"]
(
n:
helpers.defaultNullOpts.mkBool true "Set the ${n} property of the highlight group."
);
highlight = genAttrs [
"italic"
"bold"
"underline"
] (n: helpers.defaultNullOpts.mkBool true "Set the ${n} property of the highlight group.");
}

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;
};
}

Some files were not shown because too many files have changed in this diff Show more