perform some statix linting and fixes

This commit is contained in:
Tanish2002 2023-05-22 15:45:47 +05:30 committed by Gaétan Lepage
parent eee375e97e
commit efdcbe225f
57 changed files with 196 additions and 221 deletions

View file

@ -5,7 +5,7 @@
...
}: let
options = lib.evalModules {
modules = modules;
inherit modules;
specialArgs = {inherit pkgs lib;};
};
docs = pkgs.nixosOptionsDoc {

View file

@ -33,7 +33,7 @@
pkgs = mkForce pkgs;
inherit (pkgs) lib;
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
inputs = inputs;
inherit inputs;
};
};
}
@ -70,7 +70,7 @@
(import ./tests {
inherit pkgs;
inherit (pkgs) lib;
makeNixvim = self.legacyPackages."${system}".makeNixvim;
inherit (self.legacyPackages."${system}") makeNixvim;
})
// {
lib-tests = import ./tests/lib-tests.nix {
@ -103,9 +103,7 @@
}:
stdenv.mkDerivation {
pname = "run-updates";
version = pkgs.rust-analyzer.version;
src = pkgs.rust-analyzer.src;
inherit (pkgs.rust-analyzer) version src;
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra];
@ -121,7 +119,7 @@
})
{};
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
nvfetcher = pkgs.nvfetcher;
inherit (pkgs) nvfetcher;
};
legacyPackages = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
@ -144,7 +142,7 @@
}:
stdenv.mkDerivation {
pname = "alejandra-excludes";
version = alejandra.version;
inherit (alejandra) version;
dontUnpack = true;
dontBuild = true;
@ -163,7 +161,7 @@
lib = import ./lib {
inherit pkgs;
inherit (pkgs) lib;
makeNixvim = self.legacyPackages."${system}".makeNixvim;
inherit (self.legacyPackages."${system}") makeNixvim;
};
});
in

View file

@ -3,7 +3,7 @@ with lib; rec {
# vim dictionaries are, in theory, compatible with JSON
toVimDict = args:
toJSON
(lib.filterAttrs (n: v: !isNull v) args);
(lib.filterAttrs (n: v: v != null) args);
# Black functional magic that converts a bunch of different Nix types to their
# lua equivalents!
@ -25,7 +25,7 @@ with lib; rec {
(filterAttrs
(
n: v:
!isNull v && (toLuaObject v != "{}")
v != null && (toLuaObject v != "{}")
)
args)))
+ "}"
@ -43,7 +43,7 @@ with lib; rec {
then "${toString args}"
else if builtins.isInt args
then "${toString args}"
else if isNull args
else if (args == null)
then "nil"
else "";
@ -68,7 +68,7 @@ with lib; rec {
# silent = false;
# };
# };
mkModeMaps = defaults: modeMaps:
mkModeMaps = defaults:
mapAttrs
(
shortcut: action: let
@ -78,8 +78,7 @@ with lib; rec {
else action;
in
defaults // actionAttrs
)
modeMaps;
);
# Applies some default mapping options to a set of mappings
#
@ -92,10 +91,9 @@ with lib; rec {
# ...
# };
# }
mkMaps = defaults: maps:
mkMaps = defaults:
mapAttrs
(name: modeMaps: (mkModeMaps defaults modeMaps))
maps;
(name: modeMaps: (mkModeMaps defaults modeMaps));
# Creates an option with a nullable type that defaults to null.
mkNullOrOption = type: desc:
@ -105,12 +103,12 @@ with lib; rec {
description = desc;
};
mkIfNonNull' = x: y: (mkIf (!isNull x) y);
mkIfNonNull' = x: y: (mkIf (x != null) y);
mkIfNonNull = x: (mkIfNonNull' x x);
ifNonNull' = x: y:
if (isNull x)
if (x == null)
then null
else y;
@ -207,7 +205,7 @@ with lib; rec {
if builtins.isBool val
then
(
if val == false
if !val
then 0
else 1
)

View file

@ -47,7 +47,7 @@ in {
};
config = {
options.clipboard = mkIf (!isNull cfg.register) cfg.register;
options.clipboard = mkIf (cfg.register != null) cfg.register;
extraPackages =
mapAttrsToList

View file

@ -60,7 +60,7 @@ with lib; let
{
action = action;
config = {
inherit (action) <values of the config options that have been explicitly set by the user>
inherit (action) <values of the config options that have been explicitly set by the user>
};
}
*/
@ -94,8 +94,7 @@ with lib; let
normalizedAction = normalizeAction action;
in {
inherit (normalizedAction) action config;
key = key;
mode = mode;
inherit key mode;
})
maps);

View file

@ -331,10 +331,10 @@ in {
optionName: funcName: let
key = cfg.keymaps.${optionName};
in
mkIf (!isNull key) {
mkIf (key != null) {
${key} = {
action = "<Cmd>Buffer${funcName}<CR>";
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
}
)

View file

@ -305,7 +305,7 @@ in {
inherit (cfg) offsets;
groups = helpers.ifNonNull' cfg.groups {
inherit (cfg.groups) items;
options = helpers.ifNonNull' (cfg.groups.options) {
options = helpers.ifNonNull' cfg.groups.options {
toggle_hidden_on_enter = cfg.groups.options.toggleHiddenOnEnter;
};
};

View file

@ -39,7 +39,7 @@ in {
colorscheme = "base16-${cfg.colorscheme}";
extraPlugins = [cfg.package];
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
plugins.airline.theme = mkIf cfg.setUpBar "base16";
plugins.lightline.colorscheme = null;
options.termguicolors = mkIf cfg.useTruecolor true;

View file

@ -122,26 +122,26 @@ in {
globals = {
gruvbox_bold = mkIf (!cfg.bold) 0;
gruvbox_italic = mkIf (cfg.italics) 1;
gruvbox_underline = mkIf (cfg.underline) 1;
gruvbox_undercurl = mkIf (cfg.undercurl) 1;
gruvbox_transparent_bg = mkIf (cfg.transparentBg) 0;
gruvbox_contrast_dark = mkIf (!isNull cfg.contrastDark) cfg.contrastDark;
gruvbox_contrast_light = mkIf (!isNull cfg.contrastLight) cfg.contrastLight;
gruvbox_hls_cursor = mkIf (!isNull cfg.highlightSearchCursor) cfg.highlightSearchCursor;
gruvbox_number_column = mkIf (!isNull cfg.numberColumn) cfg.numberColumn;
gruvbox_sign_column = mkIf (!isNull cfg.signColumn) cfg.signColumn;
gruvbox_color_column = mkIf (!isNull cfg.colorColumn) cfg.colorColumn;
gruvbox_vert_split = mkIf (!isNull cfg.vertSplitColor) cfg.vertSplitColor;
gruvbox_italic = mkIf cfg.italics 1;
gruvbox_underline = mkIf cfg.underline 1;
gruvbox_undercurl = mkIf cfg.undercurl 1;
gruvbox_transparent_bg = mkIf cfg.transparentBg 0;
gruvbox_contrast_dark = mkIf (cfg.contrastDark != null) cfg.contrastDark;
gruvbox_contrast_light = mkIf (cfg.contrastLight != null) cfg.contrastLight;
gruvbox_hls_cursor = mkIf (cfg.highlightSearchCursor != null) cfg.highlightSearchCursor;
gruvbox_number_column = mkIf (cfg.numberColumn != null) cfg.numberColumn;
gruvbox_sign_column = mkIf (cfg.signColumn != null) cfg.signColumn;
gruvbox_color_column = mkIf (cfg.colorColumn != null) cfg.colorColumn;
gruvbox_vert_split = mkIf (cfg.vertSplitColor != null) cfg.vertSplitColor;
gruvbox_italicize_comments = mkIf (!cfg.italicizeComments) 0;
gruvbox_italicize_strings = mkIf (cfg.italicizeStrings) 1;
gruvbox_italicize_strings = mkIf cfg.italicizeStrings 1;
gruvbox_invert_selection = mkIf (!cfg.invertSelection) 0;
gruvbox_invert_signs = mkIf (cfg.invertSigns) 1;
gruvbox_invert_indent_guides = mkIf (cfg.invertIndentGuides) 1;
gruvbox_invert_tabline = mkIf (cfg.invertTabline) 1;
gruvbox_improved_strings = mkIf (cfg.improvedStrings) 1;
gruvbox_improved_warnings = mkIf (cfg.improvedWarnings) 1;
gruvbox_invert_signs = mkIf cfg.invertSigns 1;
gruvbox_invert_indent_guides = mkIf cfg.invertIndentGuides 1;
gruvbox_invert_tabline = mkIf cfg.invertTabline 1;
gruvbox_improved_strings = mkIf cfg.improvedStrings 1;
gruvbox_improved_warnings = mkIf cfg.improvedWarnings 1;
};
};
}

View file

@ -52,8 +52,7 @@ in {
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
options =
{
mode = cfg.mode;
preset = cfg.preset;
inherit (cfg) mode preset;
symbol_map = cfg.symbolMap;
}
// (
@ -61,7 +60,7 @@ in {
then {
maxwidth = cfg.cmp.maxWidth;
ellipsis_char = cfg.cmp.ellipsisChar;
menu = cfg.cmp.menu;
inherit (cfg.cmp) menu;
}
else {}
)

View file

@ -47,7 +47,7 @@ in {
mapping = mkOption {
default = null;
type = with types;
nullOr (attrsOf (either str (types.submodule ({...}: {
nullOr (attrsOf (either str (types.submodule (_: {
options = {
action = mkOption {
type = types.nonEmptyStr;
@ -259,7 +259,7 @@ in {
};
sources = let
source_config = types.submodule ({...}: {
source_config = types.submodule (_: {
options = {
name = mkOption {
type = types.str;
@ -267,7 +267,7 @@ in {
example = ''"buffer"'';
};
option = helpers.mkNullOrOption (types.attrs) ''
option = helpers.mkNullOrOption types.attrs ''
Any specific options defined by the source itself.
If direct lua code is needed use `helpers.mkRaw`.
@ -470,7 +470,7 @@ in {
then null
else false;
performance = cfg.performance;
inherit (cfg) performance;
preselect =
helpers.ifNonNull' cfg.preselect
(helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}");
@ -488,9 +488,9 @@ in {
if isString mapping
then mapping
else let
modes = mapping.modes;
inherit (mapping) modes;
modesString =
optionalString (!isNull modes && ((length modes) >= 1))
optionalString (modes != null && ((length modes) >= 1))
("," + (helpers.toLuaObject mapping.modes));
in "cmp.mapping(${mapping.action}${modesString})"
))
@ -510,7 +510,7 @@ in {
snippet = helpers.ifNonNull' cfg.snippet {
expand = let
expand = cfg.snippet.expand;
inherit (cfg.snippet) expand;
in
if isString expand
then
@ -525,12 +525,12 @@ in {
completion = helpers.ifNonNull' cfg.completion {
keyword_length = cfg.completion.keywordLength;
keyword_pattern = let
keywordPattern = cfg.completion.keywordPattern;
inherit (cfg.completion) keywordPattern;
in
helpers.ifNonNull' keywordPattern
(helpers.mkRaw "[[${keywordPattern}]]");
autocomplete = let
autocomplete = cfg.completion.autocomplete;
inherit (cfg.completion) autocomplete;
in
if isList autocomplete
then
@ -540,7 +540,7 @@ in {
autocomplete
# either null or false
else autocomplete;
completeopt = cfg.completion.completeopt;
inherit (cfg.completion) completeopt;
};
confirmation = helpers.ifNonNull' cfg.confirmation {
@ -552,7 +552,7 @@ in {
formatting = helpers.ifNonNull' cfg.formatting {
expandable_indicator = cfg.formatting.expandableIndicator;
fields = cfg.formatting.fields;
inherit (cfg.formatting) fields;
format =
helpers.ifNonNull' cfg.formatting.format
(helpers.mkRaw cfg.formatting.format);
@ -569,7 +569,7 @@ in {
sorting = helpers.ifNonNull' cfg.sorting {
priority_weight = cfg.sorting.priorityWeight;
comparators = let
comparators = cfg.sorting.comparators;
inherit (cfg.sorting) comparators;
in
helpers.ifNonNull' comparators
(
@ -605,7 +605,7 @@ in {
cfg.sources
);
view = cfg.view;
inherit (cfg) view;
window = helpers.ifNonNull' cfg.window {
completion = helpers.ifNonNull' cfg.window.completion {
inherit
@ -627,20 +627,20 @@ in {
zindex
;
max_width = let
maxWidth = cfg.window.documentation.maxWidth;
inherit (cfg.window.documentation) maxWidth;
in
if isInt maxWidth
then maxWidth
else helpers.ifNonNull' maxWidth (helpers.mkRaw maxWidth);
max_height = let
maxHeight = cfg.window.documentation.maxHeight;
inherit (cfg.window.documentation) maxHeight;
in
if isInt maxHeight
then maxHeight
else helpers.ifNonNull' maxHeight (helpers.mkRaw maxHeight);
};
};
experimental = cfg.experimental;
inherit (cfg) experimental;
};
in
mkIf cfg.enable {
@ -655,7 +655,7 @@ in {
# and enable the corresponding plugins.
plugins = let
flattened_sources =
if (isNull cfg.sources)
if (cfg.sources == null)
then []
else flatten cfg.sources;
# Take only the names from the sources provided by the user

View file

@ -1026,9 +1026,9 @@ in {
# Concatenate sources and extraSources, setting sources to it's default value if it is null
# and extraSources is not null
sources =
if (!isNull cfg.extraSources)
if (cfg.extraSources != null)
then
if (isNull cfg.sources)
if (cfg.sources == null)
then ["filesystem" "git_status" "buffers"] ++ cfg.extraSources
else cfg.sources ++ cfg.extraSources
else cfg.sources;

View file

@ -7,7 +7,7 @@
with lib; let
cfg = config.plugins.nvim-tree;
helpers = import ../helpers.nix {inherit lib;};
ifNonNull' = helpers.ifNonNull';
inherit (helpers) ifNonNull';
openWinConfigOption =
helpers.defaultNullOpts.mkNullable

View file

@ -190,25 +190,25 @@ in {
extraPackages = [pkgs.git] ++ grepPackage;
globals = {
gitgutter_max_signs = mkIf (!isNull cfg.maxSigns) cfg.maxSigns;
gitgutter_max_signs = mkIf (cfg.maxSigns != null) cfg.maxSigns;
gitgutter_show_msg_on_hunk_jumping = mkIf (!cfg.showMessageOnHunkJumping) 0;
gitgutter_map_keys = mkIf (!cfg.defaultMaps) 0;
gitgutter_sign_allow_clobber = mkIf (cfg.allowClobberSigns) 1;
gitgutter_sign_priority = mkIf (!isNull cfg.signPriority) cfg.signPriority;
gitgutter_set_sign_backgrounds = mkIf (cfg.matchBackgrounds) 1;
gitgutter_sign_allow_clobber = mkIf cfg.allowClobberSigns 1;
gitgutter_sign_priority = mkIf (cfg.signPriority != null) cfg.signPriority;
gitgutter_set_sign_backgrounds = mkIf cfg.matchBackgrounds 1;
gitgutter_sign_added = mkIf (!isNull cfg.signs.added) cfg.signs.added;
gitgutter_sign_modified = mkIf (!isNull cfg.signs.modified) cfg.signs.modified;
gitgutter_sign_removed = mkIf (!isNull cfg.signs.removed) cfg.signs.removed;
gitgutter_sign_removed_first_line = mkIf (!isNull cfg.signs.removedFirstLine) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (!isNull cfg.signs.removedAboveAndBelow) cfg.signs.removedAboveAndBelow;
gitgutter_sign_modified_above = mkIf (!isNull cfg.signs.modifiedAbove) cfg.signs.modifiedAbove;
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_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
gitgutter_diff_relative_to = mkIf (cfg.diffRelativeToWorkingTree) "working_tree";
gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";
gitgutter_git_args = mkIf (cfg.extraGitArgs != "") cfg.extraGitArgs;
gitgutter_diff_args = mkIf (cfg.extraDiffArgs != "") cfg.extraDiffArgs;
gitgutter_grep = mkIf (!isNull grepCommand) grepCommand;
gitgutter_grep = mkIf (grepCommand != null) grepCommand;
gitgutter_enabled = mkIf (!cfg.enableByDefault) 0;
gitgutter_signs = mkIf (!cfg.signsByDefault) 0;
@ -216,8 +216,8 @@ in {
gitgutter_highlight_lines = mkIf (!cfg.highlightLines) 0;
gitgutter_highlight_linenrs = mkIf (!cfg.highlightLineNumbers) 0;
gitgutter_async = mkIf (!cfg.runAsync) 0;
gitgutter_preview_win_floating = mkIf (cfg.previewWinFloating) 1;
gitgutter_use_location_list = mkIf (cfg.useLocationList) 1;
gitgutter_preview_win_floating = mkIf cfg.previewWinFloating 1;
gitgutter_use_location_list = mkIf cfg.useLocationList 1;
gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0;
};

View file

@ -1 +1 @@
args: import ../lib/helpers.nix args
import ../lib/helpers.nix

View file

@ -117,7 +117,7 @@ in
setupOptions = {
server = cfg.server.extraOptions;
extensions = {
autoSetHints = cfg.extensions.autoSetHints;
inherit (cfg.extensions) autoSetHints;
inlay_hints = {
only_current_line = cfg.extensions.inlayHints.onlyCurrentLine;
only_current_line_autocmd = cfg.extensions.inlayHints.onlyCurrentLineAutocmd;
@ -128,16 +128,11 @@ in
max_len_align_padding = cfg.extensions.inlayHints.maxLenAlignPadding;
right_align = cfg.extensions.inlayHints.rightAlign;
right_align_padding = cfg.extensions.inlayHints.rightAlignPadding;
highlight = cfg.extensions.inlayHints.highlight;
priority = cfg.extensions.inlayHints.priority;
inherit (cfg.extensions.inlayHints) highlight priority;
};
ast = {
role_icons = {
type = cfg.extensions.ast.roleIcons.type;
declaration = cfg.extensions.ast.roleIcons.declaration;
expression = cfg.extensions.ast.roleIcons.expression;
statement = cfg.extensions.ast.roleIcons.statement;
specifier = cfg.extensions.ast.roleIcons.specifier;
inherit (cfg.extensions.ast.roleIcons) type declaration expression statement specifier;
"template argument" = cfg.extensions.ast.roleIcons.templateArgument;
};
kind_icons = {
@ -150,14 +145,14 @@ in
TemplateParamObject = cfg.extensions.ast.kindIcons.templateParamObject;
};
highlights = {
detail = cfg.extensions.ast.highlights.detail;
inherit (cfg.extensions.ast.highlights) detail;
};
};
memory_usage = {
border = cfg.extensions.memoryUsage.border;
inherit (cfg.extensions.memoryUsage) border;
};
symbol_info = {
border = cfg.extensions.symbolInfo.border;
inherit (cfg.extensions.symbolInfo) border;
};
};
};

View file

@ -99,22 +99,22 @@ in {
extraPlugins = [cfg.package];
globals = {
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart;
mkdp_auto_close = mkIf (!isNull cfg.autoClose) cfg.autoClose;
mkdp_refresh_slow = mkIf (!isNull cfg.refreshSlow) cfg.refreshSlow;
mkdp_command_for_global = mkIf (!isNull cfg.commandForGlobal) cfg.commandForGlobal;
mkdp_open_to_the_world = mkIf (!isNull cfg.openToTheWorld) cfg.openToTheWorld;
mkdp_open_ip = mkIf (!isNull cfg.openIp) cfg.openIp;
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser;
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl;
mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc;
mkdp_preview_options = mkIf (!isNull cfg.previewOptions) cfg.previewOptions;
mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss;
mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss;
mkdp_port = mkIf (!isNull cfg.port) cfg.port;
mkdp_page_title = mkIf (!isNull cfg.pageTitle) cfg.pageTitle;
mkdp_filetypes = mkIf (!isNull cfg.fileTypes) cfg.fileTypes;
mkdp_theme = mkIf (!isNull cfg.theme) cfg.theme;
mkdp_auto_start = mkIf (cfg.autoStart != null) cfg.autoStart;
mkdp_auto_close = mkIf (cfg.autoClose != null) cfg.autoClose;
mkdp_refresh_slow = mkIf (cfg.refreshSlow != null) cfg.refreshSlow;
mkdp_command_for_global = mkIf (cfg.commandForGlobal != null) cfg.commandForGlobal;
mkdp_open_to_the_world = mkIf (cfg.openToTheWorld != null) cfg.openToTheWorld;
mkdp_open_ip = mkIf (cfg.openIp != null) cfg.openIp;
mkdp_browser = mkIf (cfg.browser != null) cfg.browser;
mkdp_echo_preview_url = mkIf (cfg.echoPreviewUrl != null) cfg.echoPreviewUrl;
mkdp_browserfunc = mkIf (cfg.browserFunc != null) cfg.browserFunc;
mkdp_preview_options = mkIf (cfg.previewOptions != null) cfg.previewOptions;
mkdp_markdown_css = mkIf (cfg.markdownCss != null) cfg.markdownCss;
mkdp_highlight_css = mkIf (cfg.highlightCss != null) cfg.highlightCss;
mkdp_port = mkIf (cfg.port != null) cfg.port;
mkdp_page_title = mkIf (cfg.pageTitle != null) cfg.pageTitle;
mkdp_filetypes = mkIf (cfg.fileTypes != null) cfg.fileTypes;
mkdp_theme = mkIf (cfg.theme != null) cfg.theme;
};
};
}

View file

@ -71,7 +71,7 @@ in {
'';
settings =
helpers.mkNullOrOption (types.attrs)
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
@ -79,7 +79,7 @@ in {
'';
initOptions =
helpers.mkNullOrOption (types.attrs)
helpers.mkNullOrOption types.attrs
''
Language server `initializationOptions`
You need to extend the `bundles` with paths to jar files if you want to use additional
@ -93,10 +93,10 @@ in {
config = let
cmd =
if isNull cfg.cmd
if (cfg.cmd == null)
then let
data =
if isNull cfg.data
if (cfg.data == null)
then
throw ''
You have to either set the 'plugins.nvim-jdtls.data' or the 'plugins.nvim-jdtls.cmd'
@ -109,7 +109,7 @@ in {
]
++ ["-data" data]
++ (
optionals (!isNull cfg.configuration)
optionals (cfg.configuration != null)
["-configuration" cfg.configuration]
)
else cfg.cmd;

View file

@ -45,7 +45,7 @@ in {
config = let
cfg = config.plugins.openscad;
fuzzyFinder =
if isNull cfg.fuzzyFinder
if (cfg.fuzzyFinder == null)
then defaultFuzzyFinder
else cfg.fuzzyFinder;
in

View file

@ -89,7 +89,7 @@ in {
"Customize highlight groups (setting this overrides colorscheme)"
(
mapAttrs
(optionName: defaults: colorOption defaults)
(optionName: colorOption)
{
SniprunVirtualTextOk = {
bg = "#66eeff";
@ -131,7 +131,7 @@ in {
++ (
optional
(
(!isNull cfg.display)
(cfg.display != null)
&& (any (hasPrefix "NvimNotify") cfg.display)
)
nvim-notify

View file

@ -27,6 +27,6 @@ in
extraPackages = [pkgs.ctags];
globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig;
globals = mapAttrs' (name: nameValuePair ("tagbar_" + name)) cfg.extraConfig;
};
}

View file

@ -58,7 +58,7 @@ in {
toggle_language_display = cfg.keybindings.toggleLanguageDisplay;
focus_language = cfg.keybindings.focusLanguage;
unfocus_language = cfg.keybindings.unfocusLanguage;
update = cfg.keybindings.update;
inherit (cfg.keybindings) update;
goto_node = cfg.keybindings.gotoNode;
show_help = cfg.keybindings.showHelp;
};

View file

@ -102,7 +102,7 @@ in {
tsOptions =
{
highlight = {
enable = cfg.enable;
inherit (cfg) enable;
disable =
if (cfg.disabledLanguages != [])
then cfg.disabledLanguages

View file

@ -40,6 +40,6 @@ in
# Usefull for inverse search
extraPackages = with pkgs; [pstree xdotool];
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals;
globals = mapAttrs' (name: nameValuePair ("vimtex_" + name)) globals;
};
}

View file

@ -114,7 +114,7 @@ in {
diagnosticMaps =
mapAttrs
(key: action: {
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
action = "vim.diagnostic.${action}";
lua = true;
})
@ -123,7 +123,7 @@ in {
lspBuf =
mapAttrs
(key: action: {
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
action = "vim.lsp.buf.${action}";
lua = true;
})

View file

@ -212,7 +212,7 @@ with lib; let
};
workspace = {
library = mkOption {
type = types.nullOr (types.either types.str (helpers.rawType));
type = types.nullOr (types.either types.str helpers.rawType);
description = ''
An array of abosolute or workspace-relative paths that will be added to the workspace
diagnosis - meaning you will get completion and context from these library files.
@ -356,6 +356,6 @@ with lib; let
];
in {
imports =
lib.lists.map (lspHelpers.mkLsp) servers
lib.lists.map lspHelpers.mkLsp servers
++ [./pylsp.nix];
}

View file

@ -16,12 +16,10 @@ in {
type = lib.types.nullOr (types.enum ["pycodestyle" "flake8"]);
description = "List of configuration sources to use.";
default = null;
apply = (
value:
if (value != null)
then [value]
else null
);
apply = value:
if (value != null)
then [value]
else null;
};
plugins = {
@ -502,8 +500,8 @@ in {
mkIf cfg.enable
{
extraPackages = let
isEnabled = x: (!isNull x) && (x.enabled == true);
plugins = cfg.settings.plugins;
isEnabled = x: (x != null) && (x.enabled != null && x.enabled);
inherit (cfg.settings) plugins;
in
lists.flatten (
(map

View file

@ -63,7 +63,7 @@ in {
Specifying a timeout with a value less than zero will prevent commands from timing out.
'';
diagnosticConfig = helpers.defaultNullOpts.mkNullable (types.attrs) "null" ''
diagnosticConfig = helpers.defaultNullOpts.mkNullable types.attrs "null" ''
Specifies diagnostic display options for null-ls sources, as described in
`:help vim.diagnostic.config()`.
(null-ls uses separate namespaces for each source, so server-wide configuration will not work

View file

@ -59,7 +59,7 @@
plugins.null-ls.sourcesItems = let
sourceItem = "${sourceType}.${name}";
withArgs =
if (isNull cfg.withArgs)
if (cfg.withArgs == null)
then sourceItem
else "${sourceItem}.with ${cfg.withArgs}";
finalString = ''require("null-ls").builtins.${withArgs}'';

View file

@ -84,13 +84,12 @@
serverDataFormatted =
lib.mapAttrsToList
(
sourceType: sourceSet:
lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet
sourceType: lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;})
)
serverData;
dataFlattened = lib.flatten serverDataFormatted;
in {
imports = lib.lists.map (helpers.mkServer) dataFlattened;
imports = lib.lists.map helpers.mkServer dataFlattened;
config = let
cfg = config.plugins.null-ls;

View file

@ -71,15 +71,15 @@ in {
[
cfg.package
]
++ optional (!isNull cfg.theme) vim-airline-themes;
++ optional (cfg.theme != null) vim-airline-themes;
globals =
{
airline.extensions = cfg.extensions;
airline_statusline_ontop = mkIf cfg.onTop 1;
airline_powerline_fonts = mkIf (cfg.powerline) 1;
airline_powerline_fonts = mkIf cfg.powerline 1;
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
airline_theme = mkIf (cfg.theme != null) cfg.theme;
}
// sections;
};

View file

@ -214,18 +214,16 @@ in {
inherit icons_enabled icon separator color padding;
}
extraConfig;
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
processSections = mapAttrs (_: mapNullable (map processComponent));
setupOptions = {
options = {
inherit (cfg) theme globalstatus refresh extensions;
icons_enabled = cfg.iconsEnabled;
theme = cfg.theme;
section_separators = cfg.sectionSeparators;
component_separators = cfg.componentSeparators;
disabled_filetypes = cfg.disabledFiletypes;
ignore_focus = cfg.ignoreFocus;
always_divide_middle = cfg.alwaysDivideMiddle;
globalstatus = cfg.globalstatus;
refresh = cfg.refresh;
};
sections = mapNullable processSections cfg.sections;
@ -233,7 +231,6 @@ in {
tabline = mapNullable processSections cfg.tabline;
winbar = mapNullable processSections cfg.winbar;
inactive_winbar = mapNullable processSections cfg.inactiveWinbar;
extensions = cfg.extensions;
};
in
mkIf cfg.enable {

View file

@ -92,7 +92,7 @@ in {
options =
{
extensions = cfg.extensionConfig;
defaults = cfg.defaults;
inherit (cfg) defaults;
}
// cfg.extraOptions;
in ''

View file

@ -56,7 +56,7 @@ in {
default_workspace = cfg.defaultWorkspace;
ignore_patterns = cfg.ignorePatterns;
show_scores = cfg.showScores;
workspaces = cfg.workspaces;
inherit (cfg) workspaces;
show_unindexed = cfg.showUnindexed;
devicons_disabled = cfg.deviconsDisabled;
};

View file

@ -36,7 +36,7 @@ in {
config = let
configuration = {
fuzzy = cfg.fuzzy;
inherit (cfg) fuzzy;
override_generic_sorter = cfg.overrideGenericSorter;
override_file_sorter = cfg.overrideFileSorter;
case_mode = cfg.caseMode;

View file

@ -308,7 +308,7 @@ in {
inherit (cfgLP) enabled format throttle view;
format_done = cfgLP.formatDone;
};
override = cfgL.override;
inherit (cfgL) override;
hover = helpers.ifNonNull' cfgL.hover {
inherit (cfgL.hover) enabled view opts;
};

View file

@ -30,7 +30,7 @@ in {
default = null;
};
toggler = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
line = mkOption {
type = types.str;
@ -48,7 +48,7 @@ in {
default = null;
};
opleader = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
line = mkOption {
type = types.str;
@ -66,7 +66,7 @@ in {
default = null;
};
mappings = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
basic = mkOption {
type = types.bool;
@ -93,12 +93,7 @@ in {
config = let
setupOptions = {
padding = cfg.padding;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
inherit (cfg) padding sticky ignore toggler opleader mappings;
};
in
mkIf cfg.enable {

View file

@ -127,7 +127,7 @@ in {
session_directory = cfg.sessionDirectory;
};
filteredOptions = filterAttrs (_: v: !isNull v) options;
filteredOptions = filterAttrs (_: v: v != null) options;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];

View file

@ -54,11 +54,11 @@ in {
};
'';
navNext = helpers.mkNullOrOption (types.str) ''
navNext = helpers.mkNullOrOption types.str ''
Keymap for navigating to next mark.";
'';
navPrev = helpers.mkNullOrOption (types.str) ''
navPrev = helpers.mkNullOrOption types.str ''
Keymap for navigating to previous mark.";
'';
@ -171,11 +171,10 @@ in {
mark_branch = cfg.markBranch;
};
projects = projects;
inherit projects;
menu = {
width = cfg.menu.width;
height = cfg.menu.height;
inherit (cfg.menu) width height;
borderchars = cfg.menu.borderChars;
};
}
@ -197,13 +196,14 @@ in {
(
optionName: luaFunc: let
key = km.${optionName};
in (mkIf (key != null) {
${key} = {
action = luaFunc;
lua = true;
inherit silent;
};
})
in
mkIf (key != null) {
${key} = {
action = luaFunc;
lua = true;
inherit silent;
};
}
)
{
addFile = "require('harpoon.mark').add_file";

View file

@ -118,14 +118,14 @@ in
lazy_loading = cfg.lazyLoading;
logger = {
plugin = cfg.logger.plugin;
inherit (cfg.logger) plugin;
use_console = cfg.logger.useConsole;
highlights = cfg.logger.highlights;
inherit (cfg.logger) highlights;
use_file = cfg.logger.useFile;
level = cfg.logger.level;
inherit (cfg.logger) level;
modes =
if (isNull cfg.logger.modes)
if (cfg.logger.modes == null)
then null
else
attrsets.mapAttrsToList
@ -133,7 +133,7 @@ in
name = mode;
inherit (modeConfig) hl;
level = let
level = modeConfig.level;
inherit (modeConfig) level;
in
if (isInt level)
then level

View file

@ -54,8 +54,7 @@ in {
config = let
setupOptions = with cfg; {
stages = stages;
timeout = timeout;
inherit stages timeout;
background_colour = backgroundColour;
minimum_width = minimumWidth;
icons = with icons; {

View file

@ -101,7 +101,7 @@ in {
mkIf cfg.enable {
extraPlugins = [cfg.package];
plugins.treesitter.enable = mkIf (cfg.checkTs == true) true;
plugins.treesitter.enable = mkIf (cfg.checkTs != null && cfg.checkTs) true;
extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options})

View file

@ -136,7 +136,7 @@ in {
inherit wrap;
buf_label = bufLabel;
should_preview_cb =
if isNull shouldPreviewCb
if (shouldPreviewCb == null)
then null
else helpers.mkRaw shouldPreviewCb;
};

View file

@ -61,19 +61,19 @@ in
action = "require('osc52').copy_operator";
expr = true;
lua = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
"${cfg.keymaps.copyLine}" = {
action = "${cfg.keymaps.copy}_";
remap = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
};
visual = {
"${cfg.keymaps.copyVisual}" = {
action = "require('osc52').copy_visual";
lua = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
};
};

View file

@ -161,10 +161,10 @@ in {
log_level = cfg.logLevel;
debounce_timeout = cfg.debounceTimeout;
enable_line_number = cfg.enableLineNumber;
blacklist = cfg.blacklist;
inherit (cfg) blacklist;
file_assets = cfg.fileAssets;
show_time = cfg.showTime;
buttons = cfg.buttons;
inherit (cfg) buttons;
# Rich presence text options.
editing_text = cfg.editingText;

View file

@ -66,7 +66,7 @@ in {
{
manual_mode = cfg.manualMode;
detection_methods = cfg.detectionMethods;
patterns = cfg.patterns;
inherit (cfg) patterns;
ignore_lsp = cfg.ignoreLsp;
exclude_dirs = cfg.excludeDirs;
show_hidden = cfg.showHidden;

View file

@ -129,7 +129,7 @@ in {
popup = {
inherit (cfg) blend width;
winhl =
if (!isNull cfg.color)
if (cfg.color != null)
then "SpecsPopColor"
else "PMenu";
delay_ms = cfg.delay;
@ -150,7 +150,7 @@ in {
mkIf cfg.enable {
extraPlugins = [cfg.package];
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;
highlight.SpecsPopColor.bg = mkIf (cfg.color != null) cfg.color;
extraConfigLua = ''
require('specs').setup(${setup})

View file

@ -222,9 +222,9 @@ in {
config = let
setupOptions =
{
signs = cfg.signs;
inherit (cfg) signs;
sign_priority = cfg.signPriority;
keywords = cfg.keywords;
inherit (cfg) keywords;
gui_style = cfg.guiStyle;
merge_keywords = cfg.mergeKeywords;
highlight = helpers.ifNonNull' cfg.highlight {
@ -244,14 +244,14 @@ in {
comments_only = cfg.highlight.commentsOnly;
max_line_len = cfg.highlight.maxLineLen;
};
colors = cfg.colors;
inherit (cfg) colors;
search = helpers.ifNonNull' cfg.search {
inherit (cfg.search) command args;
pattern =
helpers.ifNonNull' cfg.search.pattern
(
if isList cfg.search.pattern
then (map (p: helpers.mkRaw p) cfg.search.pattern)
then (map helpers.mkRaw cfg.search.pattern)
else helpers.mkRaw "[[${cfg.search.pattern}]]"
);
};
@ -266,7 +266,7 @@ in {
maps.normal = let
silent = cfg.keymapsSilent;
keymaps = cfg.keymaps;
inherit (cfg) keymaps;
in
mkMerge (
mapAttrsToList
@ -274,25 +274,26 @@ in {
optionName: funcName: let
keymap = keymaps.${optionName};
key = keymap.key;
inherit (keymap) key;
cwd = optionalString (!isNull keymap.cwd) " cwd=${keymap.cwd}";
keywords = optionalString (!isNull keymap.keywords) " keywords=${keymap.keywords}";
cwd = optionalString (keymap.cwd != null) " cwd=${keymap.cwd}";
keywords = optionalString (keymap.keywords != null) " keywords=${keymap.keywords}";
action = ":${funcName}${cwd}${keywords}<CR>";
in (mkIf (keymap != null) {
${key} = {
inherit silent action;
};
})
in
mkIf (keymap != null) {
${key} = {
inherit silent action;
};
}
)
commands
);
# Automatically enable plugins if keymaps have been set
plugins = mkMerge [
(mkIf (!isNull cfg.keymaps.todoTrouble) {trouble.enable = true;})
(mkIf (!isNull cfg.keymaps.todoTelescope) {telescope.enable = true;})
(mkIf (cfg.keymaps.todoTrouble != null) {trouble.enable = true;})
(mkIf (cfg.keymaps.todoTelescope != null) {telescope.enable = true;})
];
};
}

View file

@ -34,14 +34,14 @@ in {
extraPlugins = [cfg.package];
maps.normal = with cfg.keymaps;
(optionalAttrs (!isNull bdelete)
(optionalAttrs (bdelete != null)
{
${bdelete} = {
action = ":Bdelete<CR>";
silent = cfg.keymapsSilent;
};
})
// (optionalAttrs (!isNull bwipeout)
// (optionalAttrs (bwipeout != null)
{
${bwipeout} = {
action = ":Bwipeout<CR>";

View file

@ -5,7 +5,7 @@
}: let
fetchTests = import ./fetch-tests.nix;
test-derivation = import ./test-derivation.nix {inherit pkgs makeNixvim;};
mkTestDerivation = test-derivation.mkTestDerivation;
inherit (test-derivation) mkTestDerivation;
# List of files containing configurations
testFiles = fetchTests {

View file

@ -61,7 +61,7 @@
cases;
# Helper function that calls `//` for each attrset of a list
concatMany = list: lib.lists.foldr lib.mergeAttrs {} list;
concatMany = lib.lists.foldr lib.mergeAttrs {};
# An attrset of 'test-name' -> 'test-config'
in
concatMany (builtins.map handleTestFile testsListEvaluated)

View file

@ -11,7 +11,7 @@
...
}:
pkgs.stdenv.mkDerivation {
name = name;
inherit name;
nativeBuildInputs = [nvim pkgs.docker-client];

View file

@ -27,8 +27,7 @@ in {
environment.systemPackages = [cfg.finalPackage];
}
{
warnings = cfg.warnings;
assertions = cfg.assertions;
inherit (cfg) warnings assertions;
}
]);
}

View file

@ -34,8 +34,7 @@ in {
xdg.configFile = files;
})
{
warnings = cfg.warnings;
assertions = cfg.assertions;
inherit (cfg) warnings assertions;
}
]);
}

View file

@ -44,9 +44,9 @@ in {
};
config = let
files = config.files;
inherit (config) files;
concatFilesOption = attr:
lib.flatten (lib.mapAttrsToList (_: file: builtins.getAttr attr file) files);
lib.flatten (lib.mapAttrsToList (_: builtins.getAttr attr) files);
in {
# Each file can declare plugins/packages/warnings/assertions
extraPlugins = concatFilesOption "extraPlugins";
@ -59,7 +59,7 @@ in {
name = "nixvim-config";
paths =
(lib.mapAttrsToList (_: file: file.plugin) files)
++ (lib.mapAttrsToList (path: content: pkgs.writeTextDir path content) config.extraFiles);
++ (lib.mapAttrsToList pkgs.writeTextDir config.extraFiles);
};
};
}

View file

@ -113,7 +113,7 @@ in {
extraWrapperArgs = builtins.concatStringsSep " " (
(optional (config.extraPackages != [])
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
++ (optional (config.wrapRc)
++ (optional config.wrapRc
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
);

View file

@ -35,8 +35,7 @@ in {
environment.variables."VIM" = "/etc/nvim";
})
{
warnings = cfg.warnings;
assertions = cfg.assertions;
inherit (cfg) warnings assertions;
}
]);
}