mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-03 01:25:22 +02:00
added formatter + reformat existing codebase (#175)
This commit is contained in:
parent
0bf4313f22
commit
264de8cefb
96 changed files with 3727 additions and 3341 deletions
|
@ -1,17 +1,20 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.airline;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
sectionType = with types; nullOr (oneOf [ str (listOf str) ]);
|
||||
sectionType = with types; nullOr (oneOf [str (listOf str)]);
|
||||
sectionOption = mkOption {
|
||||
default = null;
|
||||
type = sectionType;
|
||||
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.airline = {
|
||||
enable = mkEnableOption "airline";
|
||||
|
@ -33,16 +36,17 @@ in
|
|||
sections = mkOption {
|
||||
description = "Statusbar sections";
|
||||
default = null;
|
||||
type = with types; nullOr (submodule {
|
||||
options = {
|
||||
a = sectionOption;
|
||||
b = sectionOption;
|
||||
c = sectionOption;
|
||||
x = sectionOption;
|
||||
y = sectionOption;
|
||||
z = sectionOption;
|
||||
};
|
||||
});
|
||||
type = with types;
|
||||
nullOr (submodule {
|
||||
options = {
|
||||
a = sectionOption;
|
||||
b = sectionOption;
|
||||
c = sectionOption;
|
||||
x = sectionOption;
|
||||
y = sectionOption;
|
||||
z = sectionOption;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
powerline = mkOption {
|
||||
|
@ -59,21 +63,24 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
sections = { };
|
||||
in
|
||||
config = let
|
||||
sections = {};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
] ++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals = {
|
||||
airline.extensions = cfg.extensions;
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
cfg.package
|
||||
]
|
||||
++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals =
|
||||
{
|
||||
airline.extensions = cfg.extensions;
|
||||
|
||||
airline_statusline_ontop = mkIf cfg.onTop 1;
|
||||
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
||||
airline_statusline_ontop = mkIf cfg.onTop 1;
|
||||
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
||||
|
||||
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||
} // sections;
|
||||
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||
}
|
||||
// sections;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lightline;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lightline;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options = {
|
||||
plugins.lightline = {
|
||||
enable = mkEnableOption "lightline";
|
||||
|
@ -51,23 +54,21 @@ in
|
|||
active = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule {
|
||||
options =
|
||||
let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in
|
||||
{
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
default = null;
|
||||
};
|
||||
|
||||
right = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the right side of the bar";
|
||||
default = null;
|
||||
};
|
||||
options = let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in {
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
default = null;
|
||||
};
|
||||
|
||||
right = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the right side of the bar";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -79,14 +80,13 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
in
|
||||
config = let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
globals.lightline = mkIf (configAttrs != { }) configAttrs;
|
||||
extraPlugins = [cfg.package];
|
||||
globals.lightline = mkIf (configAttrs != {}) configAttrs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lualine;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
separators = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
|
@ -32,7 +36,7 @@ let
|
|||
default = defaultName;
|
||||
};
|
||||
icons_enabled = mkOption {
|
||||
type = types.enum [ "True" "False" ];
|
||||
type = types.enum ["True" "False"];
|
||||
default = "True";
|
||||
description = "displays icons in alongside component";
|
||||
};
|
||||
|
@ -44,7 +48,7 @@ let
|
|||
separator = separators;
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "extra options for the component";
|
||||
};
|
||||
};
|
||||
|
@ -52,8 +56,7 @@ let
|
|||
]));
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lualine = {
|
||||
enable = mkEnableOption "lualine";
|
||||
|
@ -79,12 +82,11 @@ in
|
|||
alwaysDivideMiddle = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description =
|
||||
"When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
description = "When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
};
|
||||
|
||||
sections = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
lualine_a = component_options "mode";
|
||||
lualine_b = component_options "branch";
|
||||
|
@ -100,7 +102,7 @@ in
|
|||
};
|
||||
|
||||
tabline = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
lualine_a = component_options "";
|
||||
lualine_b = component_options "";
|
||||
|
@ -121,34 +123,45 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
processComponent = x: (if isAttrs x then processTableComponent else id) x;
|
||||
processTableComponent = { name, icons_enabled, icon, separator, extraConfig }: mergeAttrs
|
||||
{
|
||||
"@" = name;
|
||||
inherit icons_enabled icon separator;
|
||||
}
|
||||
extraConfig;
|
||||
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
|
||||
setupOptions = {
|
||||
options = {
|
||||
theme = cfg.theme;
|
||||
section_separators = cfg.sectionSeparators;
|
||||
component_separators = cfg.componentSeparators;
|
||||
disabled_filetypes = cfg.disabledFiletypes;
|
||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
|
||||
sections = mapNullable processSections cfg.sections;
|
||||
tabline = mapNullable processSections cfg.tabline;
|
||||
extensions = cfg.extensions;
|
||||
config = let
|
||||
processComponent = x:
|
||||
(
|
||||
if isAttrs x
|
||||
then processTableComponent
|
||||
else id
|
||||
)
|
||||
x;
|
||||
processTableComponent = {
|
||||
name,
|
||||
icons_enabled,
|
||||
icon,
|
||||
separator,
|
||||
extraConfig,
|
||||
}:
|
||||
mergeAttrs
|
||||
{
|
||||
"@" = name;
|
||||
inherit icons_enabled icon separator;
|
||||
}
|
||||
extraConfig;
|
||||
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
|
||||
setupOptions = {
|
||||
options = {
|
||||
theme = cfg.theme;
|
||||
section_separators = cfg.sectionSeparators;
|
||||
component_separators = cfg.componentSeparators;
|
||||
disabled_filetypes = cfg.disabledFiletypes;
|
||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
in
|
||||
|
||||
sections = mapNullable processSections cfg.sections;
|
||||
tabline = mapNullable processSections cfg.tabline;
|
||||
extensions = cfg.extensions;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraConfigLua =
|
||||
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
extraPlugins = [cfg.package];
|
||||
extraPackages = [pkgs.git];
|
||||
extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue