mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
treewide: cleanup (#324)
* statix, deadnix, alejandra * _file * _module.args * concatStringsSep "\n" -> concatLines concatStringsSep "\n" map -> concatMapStringsSep "\n" * mkShell nativeBuildInputs -> packages
This commit is contained in:
parent
f1849c0ce5
commit
8d5f23035d
29 changed files with 46 additions and 82 deletions
|
@ -30,14 +30,14 @@ in {
|
|||
"copilot-lua"
|
||||
# cfg.copilotNodePackage
|
||||
]
|
||||
++ optionals (cfg.cmp.enable) [
|
||||
++ optionals cfg.cmp.enable [
|
||||
"copilot-cmp"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.copilot = entryAnywhere ''
|
||||
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
${lib.optionalString (cfg.cmp.enable) ''
|
||||
${lib.optionalString cfg.cmp.enable ''
|
||||
require("copilot_cmp").setup()
|
||||
''}
|
||||
'';
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) listOf attrs bool enum str oneOf int;
|
||||
in {
|
||||
|
|
|
@ -103,11 +103,11 @@ in {
|
|||
end
|
||||
end
|
||||
|
||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''}
|
||||
${optionalString config.vim.ui.breadcrumbs.enable ''local navic = require("nvim-navic")''}
|
||||
default_on_attach = function(client, bufnr)
|
||||
attach_keymaps(client, bufnr)
|
||||
format_callback(client, bufnr)
|
||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''
|
||||
${optionalString config.vim.ui.breadcrumbs.enable ''
|
||||
-- let navic attach to buffers
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, bufnr)
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.types) bool listOf str enum;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
in {
|
||||
config = mkMerge [
|
||||
# TODO: move into nvim-tree file
|
||||
(mkIf (config.vim.filetree.nvimTree.enable) {
|
||||
(mkIf config.vim.filetree.nvimTree.enable {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
extensions = ["nvim-tree"];
|
||||
};
|
||||
|
@ -44,11 +44,11 @@ in {
|
|||
statusline.lualine.setupOpts = {
|
||||
options = {
|
||||
icons_enabled = cfg.icons.enable;
|
||||
theme = cfg.theme;
|
||||
inherit (cfg) theme;
|
||||
component_separators = [cfg.componentSeparator.left cfg.componentSeparator.right];
|
||||
section_separators = [cfg.sectionSeparator.left cfg.sectionSeparator.right];
|
||||
globalstatus = cfg.globalStatus;
|
||||
refresh = cfg.refresh;
|
||||
inherit (cfg) refresh;
|
||||
};
|
||||
|
||||
sections = {
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
inherit (lib.trivial) boolToString warnIf;
|
||||
in {
|
||||
onedark = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent,
|
||||
}: ''
|
||||
setup = {style ? "dark"}: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
style = "${style}"
|
||||
|
@ -33,10 +30,7 @@ in {
|
|||
};
|
||||
|
||||
dracula = {
|
||||
setup = {
|
||||
style ? null,
|
||||
transparent,
|
||||
}: ''
|
||||
setup = {transparent}: ''
|
||||
require('dracula').setup({
|
||||
transparent_bg = ${boolToString transparent},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf enum nullOr submodule bool str;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) nullOr int str attrsOf either listOf;
|
||||
inherit (lib.types) nullOr str attrsOf either listOf;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.binds.cheatsheet = {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
cfg = config.vim.binds.cheatsheet;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["cheatsheet-nvim"];
|
||||
|
||||
vim.luaConfigRC.cheaetsheet-nvim = entryAnywhere ''
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
cfg = config.vim.binds.whichKey;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["which-key"];
|
||||
|
||||
vim.luaConfigRC.whichkey = entryAnywhere ''
|
||||
|
@ -23,7 +23,7 @@ in {
|
|||
["<tab>"] = "TAB",
|
||||
},
|
||||
|
||||
${optionalString (config.vim.ui.borders.plugins.which-key.enable) ''
|
||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||
window = {
|
||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
||||
},
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf nullOr str;
|
||||
in {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
cfg = config.vim.utility.ccc;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"ccc"
|
||||
];
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
cfg = config.vim.utility.diffview-nvim;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"diffview-nvim"
|
||||
"plenary-nvim"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
cfg = config.vim.utility.icon-picker;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"icon-picker-nvim"
|
||||
"dressing-nvim"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
|
||||
inherit (lib.types) enum listOf str nullOr int;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
self = import ./glow.nix {
|
||||
inherit lib config pkgs;
|
||||
};
|
||||
mappings = self.options.vim.utility.preview.glow.mappings;
|
||||
inherit (self.options.vim.utility.preview.glow) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["glow-nvim"];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"telescope"
|
||||
"plenary-nvim"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
cfg = config.vim.utility.vim-wakatime;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
pkgs.vimPlugins.vim-wakatime
|
||||
];
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
inherit (builtins) map mapAttrs toJSON filter;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
|
||||
inherit (lib.strings) isString concatStringsSep;
|
||||
inherit (lib.strings) isString concatLines concatMapStringsSep;
|
||||
inherit (lib.misc) mapAttrsFlatten;
|
||||
inherit (lib.trivial) showWarnings;
|
||||
inherit (lib.types) str nullOr;
|
||||
|
@ -126,7 +126,7 @@ in {
|
|||
in {
|
||||
vim = {
|
||||
configRC = {
|
||||
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
|
||||
globalsScript = entryAnywhere (concatLines globalsScript);
|
||||
|
||||
# Call additional lua files with :luafile in Vimscript
|
||||
# section of the configuration, only after
|
||||
|
@ -134,14 +134,14 @@ in {
|
|||
extraLuaFiles = let
|
||||
callLuaFiles = map (file: "luafile ${file}") cfg.extraLuaFiles;
|
||||
in
|
||||
entryAfter ["globalScript"] (concatStringsSep "\n" callLuaFiles);
|
||||
entryAfter ["globalScript"] (concatLines callLuaFiles);
|
||||
|
||||
# wrap the lua config in a lua block
|
||||
# using the wrapLuaConfic function from the lib
|
||||
luaScript = let
|
||||
mapResult = result: (wrapLuaConfig {
|
||||
luaBefore = "${cfg.luaConfigPre}";
|
||||
luaConfig = concatStringsSep "\n" (map mkLuarcSection result);
|
||||
luaConfig = concatLines (map mkLuarcSection result);
|
||||
luaAfter = "${cfg.luaConfigPost}";
|
||||
});
|
||||
|
||||
|
@ -155,7 +155,7 @@ in {
|
|||
|
||||
extraPluginConfigs = let
|
||||
mapResult = result: (wrapLuaConfig {
|
||||
luaConfig = concatStringsSep "\n" (map mkLuarcSection result);
|
||||
luaConfig = concatLines (map mkLuarcSection result);
|
||||
});
|
||||
|
||||
extraPluginsDag = mapAttrs (_: {
|
||||
|
@ -189,7 +189,7 @@ in {
|
|||
icmap
|
||||
allmap
|
||||
];
|
||||
mapConfig = wrapLuaConfig {luaConfig = concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps);};
|
||||
mapConfig = wrapLuaConfig {luaConfig = concatLines (map concatLines maps);};
|
||||
in
|
||||
entryAfter ["globalsScript"] mapConfig;
|
||||
};
|
||||
|
@ -200,10 +200,10 @@ in {
|
|||
failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
|
||||
baseSystemAssertWarn =
|
||||
if failedAssertions != []
|
||||
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
|
||||
then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}"
|
||||
else showWarnings config.warnings;
|
||||
|
||||
mapResult = result: (concatStringsSep "\n" (map mkVimrcSection result));
|
||||
mapResult = result: concatMapStringsSep "\n" mkVimrcSection result;
|
||||
vimConfig = resolveDag {
|
||||
name = "vim config script";
|
||||
dag = cfg.configRC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue