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
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";

View file

@ -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 {
"<leader>m" = "+Minimap";
binds.whichKey.register = pushDownDefault {
"<leader>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'},
})
'';
};
}

View file

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

View file

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

View file

@ -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 {

View file

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

View file

@ -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]";
};
}