modules/minimap: switch to explicit lib calls

This commit is contained in:
raf 2024-03-12 03:46:46 +03:00
parent c488f0490f
commit f6db808bfc
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
7 changed files with 34 additions and 32 deletions

View file

@ -1,5 +1,6 @@
{lib, ...}: let {lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption; inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in { in {
options.vim.minimap.codewindow = { options.vim.minimap.codewindow = {
enable = mkEnableOption "codewindow plugin for minimap view"; enable = mkEnableOption "codewindow plugin for minimap view";

View file

@ -3,7 +3,9 @@
lib, lib,
... ...
}: let }: 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; cfg = config.vim.minimap.codewindow;
@ -13,26 +15,28 @@
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [ vim = {
startPlugins = [
"codewindow-nvim" "codewindow-nvim"
]; ];
vim.maps.normal = mkMerge [ maps.normal = mkMerge [
(mkSetLuaBinding mappings.open "require('codewindow').open_minimap") (mkSetLuaBinding mappings.open "require('codewindow').open_minimap")
(mkSetLuaBinding mappings.close "require('codewindow').close_minimap") (mkSetLuaBinding mappings.close "require('codewindow').close_minimap")
(mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap") (mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap")
(mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus") (mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus")
]; ];
vim.binds.whichKey.register = pushDownDefault { binds.whichKey.register = pushDownDefault {
"<leader>m" = "+Minimap"; "<leader>m" = "+Minimap";
}; };
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere '' luaConfigRC.codewindow = entryAnywhere ''
local codewindow = require('codewindow') local codewindow = require('codewindow')
codewindow.setup({ codewindow.setup({
exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'},
}) })
''; '';
}; };
};
} }

View file

@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./codewindow.nix ./codewindow.nix
./config.nix ./config.nix

View file

@ -1,4 +1,4 @@
{...}: { {
imports = [ imports = [
./minimap-vim ./minimap-vim
./codewindow ./codewindow

View file

@ -1,10 +1,11 @@
{ {
pkgs,
config, config,
pkgs,
lib, lib,
... ...
}: let }: let
inherit (lib) mkIf pushDownDefault; inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) pushDownDefault;
cfg = config.vim.minimap.minimap-vim; cfg = config.vim.minimap.minimap-vim;
in { in {

View file

@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./minimap-vim.nix ./minimap-vim.nix
./config.nix ./config.nix

View file

@ -1,11 +1,7 @@
{ {lib, ...}: let
config, inherit (lib.options) mkEnableOption;
lib,
...
}: let
inherit (lib) mkEnableOption;
in { in {
options.vim.minimap.minimap-vim = { options.vim.minimap.minimap-vim = {
enable = mkEnableOption "minimap-vim plugin for minimap view"; enable = mkEnableOption "minimap view [minimap-vim]";
}; };
} }