From f6db808bfc386ada043813f00049c10d5d3351d8 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 12 Mar 2024 03:46:46 +0300 Subject: [PATCH] modules/minimap: switch to explicit lib calls --- modules/minimap/codewindow/codewindow.nix | 3 +- modules/minimap/codewindow/config.nix | 42 +++++++++++---------- modules/minimap/codewindow/default.nix | 2 +- modules/minimap/default.nix | 2 +- modules/minimap/minimap-vim/config.nix | 5 ++- modules/minimap/minimap-vim/default.nix | 2 +- modules/minimap/minimap-vim/minimap-vim.nix | 10 ++--- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/modules/minimap/codewindow/codewindow.nix b/modules/minimap/codewindow/codewindow.nix index 551dd8e..381e310 100644 --- a/modules/minimap/codewindow/codewindow.nix +++ b/modules/minimap/codewindow/codewindow.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.minimap.codewindow = { enable = mkEnableOption "codewindow plugin for minimap view"; diff --git a/modules/minimap/codewindow/config.nix b/modules/minimap/codewindow/config.nix index b95aca8..11c38c9 100644 --- a/modules/minimap/codewindow/config.nix +++ b/modules/minimap/codewindow/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault; cfg = config.vim.minimap.codewindow; @@ -13,26 +15,28 @@ mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "codewindow-nvim" - ]; + vim = { + startPlugins = [ + "codewindow-nvim" + ]; - vim.maps.normal = mkMerge [ - (mkSetLuaBinding mappings.open "require('codewindow').open_minimap") - (mkSetLuaBinding mappings.close "require('codewindow').close_minimap") - (mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap") - (mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus") - ]; + maps.normal = mkMerge [ + (mkSetLuaBinding mappings.open "require('codewindow').open_minimap") + (mkSetLuaBinding mappings.close "require('codewindow').close_minimap") + (mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap") + (mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus") + ]; - vim.binds.whichKey.register = pushDownDefault { - "m" = "+Minimap"; + binds.whichKey.register = pushDownDefault { + "m" = "+Minimap"; + }; + + luaConfigRC.codewindow = entryAnywhere '' + local codewindow = require('codewindow') + codewindow.setup({ + exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, + }) + ''; }; - - vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere '' - local codewindow = require('codewindow') - codewindow.setup({ - exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, - }) - ''; }; } diff --git a/modules/minimap/codewindow/default.nix b/modules/minimap/codewindow/default.nix index f3f8a9a..0ce3ad2 100644 --- a/modules/minimap/codewindow/default.nix +++ b/modules/minimap/codewindow/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./codewindow.nix ./config.nix diff --git a/modules/minimap/default.nix b/modules/minimap/default.nix index 6a03b01..7612ac1 100644 --- a/modules/minimap/default.nix +++ b/modules/minimap/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ imports = [ ./minimap-vim ./codewindow diff --git a/modules/minimap/minimap-vim/config.nix b/modules/minimap/minimap-vim/config.nix index 6577e8c..5276a42 100644 --- a/modules/minimap/minimap-vim/config.nix +++ b/modules/minimap/minimap-vim/config.nix @@ -1,10 +1,11 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) mkIf pushDownDefault; + inherit (lib.modules) mkIf; + inherit (lib.nvim.binds) pushDownDefault; cfg = config.vim.minimap.minimap-vim; in { diff --git a/modules/minimap/minimap-vim/default.nix b/modules/minimap/minimap-vim/default.nix index 889184e..bf3aa55 100644 --- a/modules/minimap/minimap-vim/default.nix +++ b/modules/minimap/minimap-vim/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./minimap-vim.nix ./config.nix diff --git a/modules/minimap/minimap-vim/minimap-vim.nix b/modules/minimap/minimap-vim/minimap-vim.nix index 12f7f42..e8f9270 100644 --- a/modules/minimap/minimap-vim/minimap-vim.nix +++ b/modules/minimap/minimap-vim/minimap-vim.nix @@ -1,11 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.minimap.minimap-vim = { - enable = mkEnableOption "minimap-vim plugin for minimap view"; + enable = mkEnableOption "minimap view [minimap-vim]"; }; }