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

@ -7,118 +7,118 @@
}:
with lib;
with helpers.vim-plugin;
mkVimPlugin config {
name = "airline";
originalName = "vim-airline";
defaultPackage = pkgs.vimPlugins.vim-airline;
globalPrefix = "airline_";
mkVimPlugin config {
name = "airline";
originalName = "vim-airline";
defaultPackage = pkgs.vimPlugins.vim-airline;
globalPrefix = "airline_";
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"sectionA"
"sectionB"
"sectionC"
"sectionX"
"sectionY"
"sectionZ"
"experimental"
"leftSep"
"rightSep"
"detectModified"
"detectPaste"
"detectCrypt"
"detectSpell"
"detectSpelllang"
"detectIminsert"
"inactiveCollapse"
"inactiveAltSep"
"theme"
"themePatchFunc"
"powerlineFonts"
"symbolsAscii"
"modeMap"
"excludeFilenames"
"excludeFiletypes"
"filetypeOverrides"
"excludePreview"
"disableStatusline"
"skipEmptySections"
"highlightingCache"
"focuslostInactive"
"statuslineOntop"
"stlPathStyle"
"sectionCOnlyFilename"
"symbols"
];
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"sectionA"
"sectionB"
"sectionC"
"sectionX"
"sectionY"
"sectionZ"
"experimental"
"leftSep"
"rightSep"
"detectModified"
"detectPaste"
"detectCrypt"
"detectSpell"
"detectSpelllang"
"detectIminsert"
"inactiveCollapse"
"inactiveAltSep"
"theme"
"themePatchFunc"
"powerlineFonts"
"symbolsAscii"
"modeMap"
"excludeFilenames"
"excludeFiletypes"
"filetypeOverrides"
"excludePreview"
"disableStatusline"
"skipEmptySections"
"highlightingCache"
"focuslostInactive"
"statuslineOntop"
"stlPathStyle"
"sectionCOnlyFilename"
"symbols"
];
settingsOptions =
(
listToAttrs (
map
(
name:
nameValuePair
"section_${name}"
(
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
oneOf
[
rawLua
str
(listOf str)
(attrsOf anything)
]
)
"Configuration for this section."
)
)
["a" "b" "c" "x" "y" "z"]
)
)
// {
experimental = helpers.defaultNullOpts.mkBool true ''
Enable experimental features.
Currently: Enable Vim9 Script implementation.
'';
left_sep = helpers.defaultNullOpts.mkStr ">" ''
The separator used on the left side.
'';
right_sep = helpers.defaultNullOpts.mkStr "<" ''
The separator used on the right side.
'';
detect_modified = helpers.defaultNullOpts.mkBool true ''
Enable modified detection.
'';
detect_paste = helpers.defaultNullOpts.mkBool true ''
Enable paste detection.
'';
detect_crypt = helpers.defaultNullOpts.mkBool true ''
Enable crypt detection.
'';
detect_spell = helpers.defaultNullOpts.mkBool true ''
Enable spell detection.
'';
detect_spelllang =
helpers.defaultNullOpts.mkNullable
(
with helpers.nixvimTypes;
settingsOptions =
(listToAttrs (
map
(
name:
nameValuePair "section_${name}" (
helpers.mkNullOrOption (
with helpers.nixvimTypes;
oneOf [
rawLua
bool
(enum ["flag"])
str
(listOf str)
(attrsOf anything)
]
) "Configuration for this section."
)
)
[
"a"
"b"
"c"
"x"
"y"
"z"
]
))
// {
experimental = helpers.defaultNullOpts.mkBool true ''
Enable experimental features.
Currently: Enable Vim9 Script implementation.
'';
left_sep = helpers.defaultNullOpts.mkStr ">" ''
The separator used on the left side.
'';
right_sep = helpers.defaultNullOpts.mkStr "<" ''
The separator used on the right side.
'';
detect_modified = helpers.defaultNullOpts.mkBool true ''
Enable modified detection.
'';
detect_paste = helpers.defaultNullOpts.mkBool true ''
Enable paste detection.
'';
detect_crypt = helpers.defaultNullOpts.mkBool true ''
Enable crypt detection.
'';
detect_spell = helpers.defaultNullOpts.mkBool true ''
Enable spell detection.
'';
detect_spelllang =
helpers.defaultNullOpts.mkNullable
(
with helpers.nixvimTypes;
oneOf [
rawLua
bool
(enum [ "flag" ])
]
)
"true"
''
@ -129,101 +129,79 @@ with helpers.vim-plugin;
'spelllang' itself.
'';
detect_iminsert = helpers.defaultNullOpts.mkBool false ''
Enable iminsert detection.
'';
detect_iminsert = helpers.defaultNullOpts.mkBool false ''
Enable iminsert detection.
'';
inactive_collapse = helpers.defaultNullOpts.mkBool true ''
Determine whether inactive windows should have the left section collapsed to only the
filename of that buffer.
'';
inactive_collapse = helpers.defaultNullOpts.mkBool true ''
Determine whether inactive windows should have the left section collapsed to only the
filename of that buffer.
'';
inactive_alt_sep = helpers.defaultNullOpts.mkBool true ''
Use alternative separators for the statusline of inactive windows.
'';
inactive_alt_sep = helpers.defaultNullOpts.mkBool true ''
Use alternative separators for the statusline of inactive windows.
'';
theme = helpers.defaultNullOpts.mkStr "dark" ''
Themes are automatically selected based on the matching colorscheme.
This can be overridden by defining a value.
theme = helpers.defaultNullOpts.mkStr "dark" ''
Themes are automatically selected based on the matching colorscheme.
This can be overridden by defining a value.
Note: Only the dark theme is distributed with vim-airline.
For more themes, checkout the vim-airline-themes repository
(https://github.com/vim-airline/vim-airline-themes)
'';
Note: Only the dark theme is distributed with vim-airline.
For more themes, checkout the vim-airline-themes repository
(https://github.com/vim-airline/vim-airline-themes)
'';
theme_patch_func = helpers.mkNullOrStr ''
If you want to patch the airline theme before it gets applied, you can supply the name of
a function where you can modify the palette.
theme_patch_func = helpers.mkNullOrStr ''
If you want to patch the airline theme before it gets applied, you can supply the name of
a function where you can modify the palette.
Example: "AirlineThemePatch"
Example: "AirlineThemePatch"
Then, define this function using `extraConfigVim`:
```nix
extraConfigVim = \'\'
function! AirlineThemePatch(palette)
if g:airline_theme == 'badwolf'
for colors in values(a:palette.inactive)
let colors[3] = 245
endfor
endif
endfunction
\'\';
```
'';
Then, define this function using `extraConfigVim`:
```nix
extraConfigVim = \'\'
function! AirlineThemePatch(palette)
if g:airline_theme == 'badwolf'
for colors in values(a:palette.inactive)
let colors[3] = 245
endfor
endif
endfunction
\'\';
```
'';
powerline_fonts = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want the powerline symbols set this variable to `true`.
'';
powerline_fonts = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want the powerline symbols set this variable to `true`.
'';
symbols_ascii = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want to use plain ascii symbols, set this variable: >
'';
symbols_ascii = helpers.defaultNullOpts.mkBool false ''
By default, airline will use unicode symbols if your encoding matches utf-8.
If you want to use plain ascii symbols, set this variable: >
'';
mode_map =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
maybeRaw (attrsOf str)
)
''
Define the set of text to display for each mode.
mode_map = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf str)) ''
Define the set of text to display for each mode.
Default: see source
'';
Default: see source
'';
exclude_filenames =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
maybeRaw (listOf str)
)
''
Define the set of filename match queries which excludes a window from having its
statusline modified.
exclude_filenames = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) ''
Define the set of filename match queries which excludes a window from having its
statusline modified.
Default: see source for current list
'';
Default: see source for current list
'';
exclude_filetypes =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
maybeRaw (listOf str)
)
''
Define the set of filetypes which are excluded from having its window statusline modified.
exclude_filetypes = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) ''
Define the set of filetypes which are excluded from having its window statusline modified.
Default: see source for current list
'';
Default: see source for current list
'';
filetype_overrides =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
maybeRaw (attrsOf (listOf str))
)
filetype_overrides =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf (listOf str)))
''
Define the set of names to be displayed instead of a specific filetypes.
@ -245,75 +223,75 @@ with helpers.vim-plugin;
```
'';
exclude_preview = helpers.defaultNullOpts.mkBool false ''
Defines whether the preview window should be excluded from having its window statusline
modified (may help with plugins which use the preview window heavily).
'';
exclude_preview = helpers.defaultNullOpts.mkBool false ''
Defines whether the preview window should be excluded from having its window statusline
modified (may help with plugins which use the preview window heavily).
'';
disable_statusline = helpers.defaultNullOpts.mkBool false ''
Disable the Airline statusline customization globally.
disable_statusline = helpers.defaultNullOpts.mkBool false ''
Disable the Airline statusline customization globally.
This setting disables setting the 'statusline' option.
This allows to use e.g. the tabline extension (`|airline-tabline|`) but keep the
'statusline' option totally configurable by a custom configuration.
'';
This setting disables setting the 'statusline' option.
This allows to use e.g. the tabline extension (`|airline-tabline|`) but keep the
'statusline' option totally configurable by a custom configuration.
'';
skip_empty_sections = helpers.defaultNullOpts.mkBool true ''
Do not draw separators for empty sections (only for the active window).
'';
skip_empty_sections = helpers.defaultNullOpts.mkBool true ''
Do not draw separators for empty sections (only for the active window).
'';
highlighting_cache = helpers.defaultNullOpts.mkBool false ''
Caches the changes to the highlighting groups, should therefore be faster.
Set this to one, if you experience a sluggish Vim.
'';
highlighting_cache = helpers.defaultNullOpts.mkBool false ''
Caches the changes to the highlighting groups, should therefore be faster.
Set this to one, if you experience a sluggish Vim.
'';
focuslost_inactive = helpers.defaultNullOpts.mkBool false ''
Disable airline on FocusLost autocommand (e.g. when Vim loses focus).
'';
focuslost_inactive = helpers.defaultNullOpts.mkBool false ''
Disable airline on FocusLost autocommand (e.g. when Vim loses focus).
'';
statusline_ontop = helpers.defaultNullOpts.mkBool false ''
Display the statusline in the tabline (first top line).
statusline_ontop = helpers.defaultNullOpts.mkBool false ''
Display the statusline in the tabline (first top line).
Setting this option, allows to use the statusline option to be used by a custom function
or another plugin, since airline won't change it.
Setting this option, allows to use the statusline option to be used by a custom function
or another plugin, since airline won't change it.
Note: This setting is experimental and works on a best effort approach.
Updating the statusline might not always happen as fast as needed, but that is a
limitation, that comes from Vim.
airline tries to force an update if needed, but it might not always work as expected.
To force updating the tabline on mode changes, call `airline#check_mode()` in your custom
statusline setting: `:set stl=%!airline#check_mode(winnr())` will correctly update the
tabline on mode changes.
'';
Note: This setting is experimental and works on a best effort approach.
Updating the statusline might not always happen as fast as needed, but that is a
limitation, that comes from Vim.
airline tries to force an update if needed, but it might not always work as expected.
To force updating the tabline on mode changes, call `airline#check_mode()` in your custom
statusline setting: `:set stl=%!airline#check_mode(winnr())` will correctly update the
tabline on mode changes.
'';
stl_path_style = helpers.defaultNullOpts.mkStr "short" ''
Display a short path in statusline.
'';
stl_path_style = helpers.defaultNullOpts.mkStr "short" ''
Display a short path in statusline.
'';
section_c_only_filename = helpers.defaultNullOpts.mkBool true ''
Display a only file name in statusline.
'';
section_c_only_filename = helpers.defaultNullOpts.mkBool true ''
Display a only file name in statusline.
'';
symbols = helpers.mkNullOrOption (with types; attrsOf str) ''
Customize airline symbols.
symbols = helpers.mkNullOrOption (with types; attrsOf str) ''
Customize airline symbols.
Example:
```nix
{
branch = "";
colnr = " :";
readonly = "";
linenr = " :";
maxlinenr = " ";
dirty= "";
}
```
'';
};
settingsExample = {
powerline_fonts = true;
theme = "base16";
skip_empty_sections = true;
Example:
```nix
{
branch = "";
colnr = " :";
readonly = "";
linenr = " :";
maxlinenr = " ";
dirty= "";
}
```
'';
};
}
settingsExample = {
powerline_fonts = true;
theme = "base16";
skip_empty_sections = true;
};
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.lightline;
in {
in
{
options = {
plugins.lightline = {
enable = mkEnableOption "lightline";
@ -53,28 +55,36 @@ in {
active = mkOption {
default = null;
type = types.nullOr (types.submodule {
options = let
listType = with helpers.nixvimTypes; maybeRaw (listOf (listOf str));
in {
left = helpers.mkNullOrOption listType "List of components that will show up on the left side of the bar";
type = types.nullOr (
types.submodule {
options =
let
listType = with helpers.nixvimTypes; maybeRaw (listOf (listOf str));
in
{
left = helpers.mkNullOrOption listType "List of components that will show up on the left side of the bar";
right = helpers.mkNullOrOption listType "List of components that will show up on the right side of the bar";
};
});
right = helpers.mkNullOrOption listType "List of components that will show up on the right side of the bar";
};
}
);
};
inactive = mkOption {
default = null;
type = types.nullOr (types.submodule {
options = let
listType = with helpers.nixvimTypes; maybeRaw (listOf (listOf str));
in {
left = helpers.mkNullOrOption listType "List of components that will show up on the left side of the bar";
type = types.nullOr (
types.submodule {
options =
let
listType = with helpers.nixvimTypes; maybeRaw (listOf (listOf str));
in
{
left = helpers.mkNullOrOption listType "List of components that will show up on the left side of the bar";
right = helpers.mkNullOrOption listType "List of components that will show up on the right side of the bar";
};
});
right = helpers.mkNullOrOption listType "List of components that will show up on the right side of the bar";
};
}
);
};
modeMap = mkOption {
@ -85,13 +95,21 @@ in {
};
};
config = let
configAttrs = filterAttrs (_: v: v != null) {
inherit (cfg) colorscheme active inactive component componentFunction modeMap;
};
in
config =
let
configAttrs = filterAttrs (_: v: v != null) {
inherit (cfg)
colorscheme
active
inactive
component
componentFunction
modeMap
;
};
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
globals.lightline = mkIf (configAttrs != {}) configAttrs;
extraPlugins = [ cfg.package ];
globals.lightline = mkIf (configAttrs != { }) configAttrs;
};
}

View file

@ -5,24 +5,26 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.lualine;
mkSeparatorsOption = {
leftDefault ? " ",
rightDefault ? " ",
}: {
left = helpers.defaultNullOpts.mkStr leftDefault "Left separator";
right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
};
mkSeparatorsOption =
{
leftDefault ? " ",
rightDefault ? " ",
}:
{
left = helpers.defaultNullOpts.mkStr leftDefault "Left separator";
right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
};
mkComponentOptions = defaultName:
helpers.mkNullOrOption
(with types;
mkComponentOptions =
defaultName:
helpers.mkNullOrOption (
with types;
listOf (
either
str
(submodule {
either str (submodule {
options = {
name = mkOption {
type = types.either types.str helpers.nixvimTypes.rawLua;
@ -34,51 +36,40 @@ with lib; let
Enables the display of icons alongside the component.
'';
icon =
helpers.mkNullOrOption
(
with types;
either
str
(submodule {
freeformType = attrsOf anything;
icon = helpers.mkNullOrOption (
with types;
either str (submodule {
freeformType = attrsOf anything;
options = {
icon = mkOption {
type = str;
description = "Icon character.";
};
};
})
)
"Defines the icon to be displayed in front of the component.";
options = {
icon = mkOption {
type = str;
description = "Icon character.";
};
};
})
) "Defines the icon to be displayed in front of the component.";
separator = mkSeparatorsOption {};
separator = mkSeparatorsOption { };
color = helpers.mkNullOrOption (types.attrsOf types.str) ''
Defines a custom color for the component.
'';
padding =
helpers.defaultNullOpts.mkNullable
(
types.either
types.int
(types.submodule {
options = {
left = mkOption {
type = types.int;
description = "left padding";
};
right = mkOption {
type = types.int;
description = "left padding";
};
padding = helpers.defaultNullOpts.mkNullable (types.either types.int (
types.submodule {
options = {
left = mkOption {
type = types.int;
description = "left padding";
};
})
)
"1"
"Adds padding to the left and right of components.";
right = mkOption {
type = types.int;
description = "left padding";
};
};
}
)) "1" "Adds padding to the left and right of components.";
fmt = helpers.mkNullOrLuaFn ''
A lua function to format the component string.
@ -93,13 +84,13 @@ with lib; let
extraConfig = mkOption {
type = types.attrs;
default = {};
default = { };
description = "extra options for the component";
};
};
})
))
"";
)
) "";
mkEmptySectionOption = name: {
lualine_a = mkComponentOptions "";
@ -109,7 +100,8 @@ with lib; let
lualine_y = mkComponentOptions "";
lualine_z = mkComponentOptions "";
};
in {
in
{
options = {
plugins.lualine = {
enable = mkEnableOption "lualine";
@ -122,7 +114,9 @@ in {
default = true;
};
theme = helpers.defaultNullOpts.mkNullable (with types; either str attrs) "auto" "The theme to use for lualine-nvim.";
theme = helpers.defaultNullOpts.mkNullable (
with types; either str attrs
) "auto" "The theme to use for lualine-nvim.";
componentSeparators = mkSeparatorsOption {
leftDefault = "";
@ -204,58 +198,58 @@ in {
};
};
};
config = let
processComponent = x:
(
if isAttrs x
then processTableComponent
else id
)
x;
processTableComponent = {
name,
icons_enabled,
icon,
separator,
color,
padding,
extraConfig,
fmt,
}:
mergeAttrs
{
"__unkeyed" = name;
icon =
if isAttrs icon
then removeAttrs (icon // {"__unkeyed" = icon.icon;}) ["icon"]
else icon;
inherit icons_enabled separator color padding fmt;
}
extraConfig;
processSections = mapAttrs (_: mapNullable (map processComponent));
setupOptions = {
options = {
inherit (cfg) theme globalstatus refresh extensions;
icons_enabled = cfg.iconsEnabled;
section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes;
ignore_focus = cfg.ignoreFocus;
always_divide_middle = cfg.alwaysDivideMiddle;
};
config =
let
processComponent = x: (if isAttrs x then processTableComponent else id) x;
processTableComponent =
{
name,
icons_enabled,
icon,
separator,
color,
padding,
extraConfig,
fmt,
}:
mergeAttrs {
"__unkeyed" = name;
icon = if isAttrs icon then removeAttrs (icon // { "__unkeyed" = icon.icon; }) [ "icon" ] else icon;
inherit
icons_enabled
separator
color
padding
fmt
;
} extraConfig;
processSections = mapAttrs (_: mapNullable (map processComponent));
setupOptions = {
options = {
inherit (cfg)
theme
globalstatus
refresh
extensions
;
icons_enabled = cfg.iconsEnabled;
section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes;
ignore_focus = cfg.ignoreFocus;
always_divide_middle = cfg.alwaysDivideMiddle;
};
sections = processSections cfg.sections;
inactive_sections = processSections cfg.inactiveSections;
tabline = processSections cfg.tabline;
winbar = processSections cfg.winbar;
inactive_winbar = processSections cfg.inactiveWinbar;
};
in
sections = processSections cfg.sections;
inactive_sections = processSections cfg.inactiveSections;
tabline = processSections cfg.tabline;
winbar = processSections cfg.winbar;
inactive_winbar = processSections cfg.inactiveWinbar;
};
in
mkIf cfg.enable {
extraPlugins =
[cfg.package]
++ (optional cfg.iconsEnabled pkgs.vimPlugins.nvim-web-devicons);
extraPackages = [pkgs.git];
extraPlugins = [ cfg.package ] ++ (optional cfg.iconsEnabled pkgs.vimPlugins.nvim-web-devicons);
extraPackages = [ pkgs.git ];
extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
};
}