treewide: Reformat with nixfmt

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

View file

@ -5,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})