mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 13:45:58 +01:00
treewide: change modules to use 'inherit (builtins) ...
This commit is contained in:
parent
c77b007a26
commit
4dc7576176
19 changed files with 59 additions and 42 deletions
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) mkIf nvim mkLuaBinding mkMerge;
|
||||
|
||||
cfg = config.vim.assistant.copilot;
|
||||
|
@ -13,7 +14,7 @@
|
|||
local s, _ = pcall(${luaFunction})
|
||||
|
||||
if not s then
|
||||
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON key}, true, false, true)
|
||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON key}, true, false, true)
|
||||
|
||||
vim.fn.feedkeys(termcode, 'n')
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) mkIf mkMerge mkExprBinding boolToString nvim;
|
||||
|
||||
cfg = config.vim.assistant.tabnine;
|
||||
|
@ -17,7 +18,7 @@ in {
|
|||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${builtins.toJSON cfg.mappings.accept}"
|
||||
return "${toJSON cfg.mappings.accept}"
|
||||
end
|
||||
|
||||
vim.schedule(completion.accept)
|
||||
|
@ -29,7 +30,7 @@ in {
|
|||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${builtins.toJSON cfg.mappings.dismiss}"
|
||||
return "${toJSON cfg.mappings.dismiss}"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) concatStringsSep;
|
||||
inherit (lib) optionalString mkIf nvim;
|
||||
|
||||
cfg = config.vim;
|
||||
|
@ -141,7 +142,7 @@ in {
|
|||
''}
|
||||
${optionalString cfg.spellChecking.enable ''
|
||||
set spell
|
||||
set spelllang=${builtins.concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
|
||||
set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
|
||||
''}
|
||||
${optionalString (cfg.leaderKey != null) ''
|
||||
let mapleader = "${toString cfg.leaderKey}"
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) addDescriptionsToMappings concatMapStringsSep attrNames concatStringsSep mapAttrsToList nvim mkIf mkSetLuaBinding mkMerge optionalString;
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) addDescriptionsToMappings concatMapStringsSep attrNames concatStringsSep mapAttrsToList mkIf mkSetLuaBinding mkMerge optionalString;
|
||||
inherit (lib.nvim) dag;
|
||||
|
||||
cfg = config.vim.autocomplete;
|
||||
lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable;
|
||||
|
@ -31,8 +33,8 @@
|
|||
|
||||
dagPlacement =
|
||||
if lspkindEnabled
|
||||
then nvim.dag.entryAfter ["lspkind"]
|
||||
else nvim.dag.entryAnywhere;
|
||||
then dag.entryAfter ["lspkind"]
|
||||
else dag.entryAnywhere;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
|
@ -59,7 +61,7 @@ in {
|
|||
(mkSetLuaBinding mappings.confirm ''
|
||||
function()
|
||||
if not require('cmp').confirm({ select = true }) then
|
||||
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.confirm.value}, true, false, true)
|
||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)
|
||||
|
||||
vim.fn.feedkeys(termcode, 'n')
|
||||
end
|
||||
|
@ -85,7 +87,7 @@ in {
|
|||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true)
|
||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
|
||||
|
||||
vim.fn.feedkeys(termcode, 'n')
|
||||
end
|
||||
|
@ -152,7 +154,7 @@ in {
|
|||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true)
|
||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
|
||||
|
||||
vim.fn.feedkeys(termcode, 'n')
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with builtins; let
|
||||
}: let
|
||||
inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter;
|
||||
inherit (lib) mkOption types mapAttrsFlatten filterAttrs optionalString getAttrs literalExpression;
|
||||
inherit (lib) nvim;
|
||||
inherit (nvim.lua) toLuaObject;
|
||||
|
@ -84,7 +84,7 @@ with builtins; let
|
|||
else action.action;
|
||||
};
|
||||
in
|
||||
builtins.attrValues (builtins.mapAttrs
|
||||
attrValues (mapAttrs
|
||||
(key: action: let
|
||||
normalizedAction = normalizeAction action;
|
||||
in {
|
||||
|
@ -258,7 +258,7 @@ in {
|
|||
(filterNonNull cfg.globals);
|
||||
|
||||
toLuaBindings = mode: maps:
|
||||
builtins.map (value: ''
|
||||
map (value: ''
|
||||
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
|
||||
'') (genMaps mode maps);
|
||||
|
||||
|
@ -282,7 +282,7 @@ in {
|
|||
}: let
|
||||
# When the value is a string, default it to dag.entryAnywhere
|
||||
finalDag = lib.mapAttrs (_: value:
|
||||
if builtins.isString value
|
||||
if isString value
|
||||
then nvim.dag.entryAnywhere value
|
||||
else value)
|
||||
dag;
|
||||
|
@ -290,7 +290,7 @@ in {
|
|||
result =
|
||||
if sortedDag ? result
|
||||
then mapResult sortedDag.result
|
||||
else abort ("Dependency cycle in ${name}: " + toJSON sortedConfig);
|
||||
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
||||
in
|
||||
result;
|
||||
in {
|
||||
|
|
|
@ -5,8 +5,8 @@ inputs: {
|
|||
check ? true,
|
||||
extraSpecialArgs ? {},
|
||||
}: let
|
||||
inherit (pkgs) wrapNeovim vimPlugins;
|
||||
inherit (builtins) map filter isString toString getAttr;
|
||||
inherit (pkgs) wrapNeovim vimPlugins;
|
||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||
|
||||
extendedLib = import ../lib/stdlib-extended.nix lib;
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetExprBinding toJSON mkSetLuaBinding nvim;
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetExprBinding mkSetLuaBinding nvim;
|
||||
|
||||
cfg = config.vim.git;
|
||||
|
||||
self = import ./git.nix {inherit lib;};
|
||||
|
@ -19,7 +21,7 @@ in {
|
|||
vim.maps.normal = mkMerge [
|
||||
(mkSetExprBinding gsMappings.nextHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${builtins.toJSON gsMappings.nextHunk.value} end
|
||||
if vim.wo.diff then return ${toJSON gsMappings.nextHunk.value} end
|
||||
|
||||
vim.schedule(function() package.loaded.gitsigns.next_hunk() end)
|
||||
|
||||
|
@ -28,7 +30,7 @@ in {
|
|||
'')
|
||||
(mkSetExprBinding gsMappings.previousHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${builtins.toJSON gsMappings.previousHunk.value} end
|
||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||
|
||||
vim.schedule(function() package.loaded.gitsigns.prev_hunk() end)
|
||||
|
||||
|
@ -69,7 +71,7 @@ in {
|
|||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.code_actions.gitsigns
|
||||
null_ls.gcode_actions.gitsigns
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkOption mkEnableOption types isList nvim;
|
||||
|
||||
cfg = config.vim.languages.bash;
|
||||
|
@ -69,7 +70,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Bash LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -89,7 +90,7 @@ in {
|
|||
};
|
||||
type = mkOption {
|
||||
description = "Bash formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim optionalString mkEnableOption mkOption types mkIf mkMerge;
|
||||
|
||||
cfg = config.vim.languages.clang;
|
||||
|
@ -93,7 +94,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "The clang LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -119,7 +120,7 @@ in {
|
|||
};
|
||||
debugger = mkOption {
|
||||
description = "clang debugger to use";
|
||||
type = with types; enum (builtins.attrNames debuggers);
|
||||
type = with types; enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
package = mkOption {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types optionalString;
|
||||
|
||||
cfg = config.vim.languages.dart;
|
||||
|
@ -38,7 +39,7 @@ in {
|
|||
enable = mkEnableOption "Dart LSP support";
|
||||
server = mkOption {
|
||||
description = "The Dart LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
package = mkOption {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim getExe mkEnableOption mkOption types mkMerge mkIf;
|
||||
|
||||
cfg = config.vim.languages.go;
|
||||
|
@ -80,7 +81,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Go LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -100,7 +101,7 @@ in {
|
|||
};
|
||||
debugger = mkOption {
|
||||
description = "Go debugger to use";
|
||||
type = with types; enum (builtins.attrNames debuggers);
|
||||
type = with types; enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
package = mkOption {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString;
|
||||
|
||||
cfg = config.vim.languages.nix;
|
||||
|
@ -146,7 +147,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Nix formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
package = mkOption {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
|
||||
|
||||
cfg = config.vim.languages.php;
|
||||
|
@ -72,7 +73,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "PHP LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe literalExpression;
|
||||
|
||||
cfg = config.vim.languages.python;
|
||||
|
@ -149,7 +150,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Python LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -166,7 +167,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Python formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
|
@ -186,7 +187,7 @@ in {
|
|||
};
|
||||
debugger = mkOption {
|
||||
description = "Python debugger to use";
|
||||
type = with types; enum (builtins.attrNames debuggers);
|
||||
type = with types; enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
package = mkOption {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
|
||||
cfg = config.vim.languages.sql;
|
||||
|
@ -86,7 +87,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "SQL LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -103,7 +104,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "SQL formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
|
||||
cfg = config.vim.languages.svelte;
|
||||
|
@ -72,7 +73,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Svelte LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -89,7 +90,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Svelte formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
@ -98,7 +99,7 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Typescript/Javascript LSP server to use";
|
||||
type = with types; enum (builtins.attrNames servers);
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
|
@ -115,7 +116,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Typescript/Javascript formatter to use";
|
||||
type = with types; enum (builtins.attrNames formats);
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) mkMerge mkIf mkBinding nvim getExe;
|
||||
|
||||
cfg = config.vim.terminal.toggleterm;
|
||||
|
@ -59,7 +60,7 @@ in {
|
|||
end
|
||||
})
|
||||
|
||||
vim.keymap.set('n', ${builtins.toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = 'Open lazygit [toggleterm]'})
|
||||
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = 'Open lazygit [toggleterm]'})
|
||||
'';
|
||||
}
|
||||
)
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with builtins; let
|
||||
}: let
|
||||
inherit (lib) optionalString boolToString mkIf optionals;
|
||||
inherit (lib.nvim.lua) nullString;
|
||||
|
||||
|
|
Loading…
Reference in a new issue