{ config, lib, ... }: let inherit (lib.options) mkEnableOption mkOption; inherit (lib.lists) optionals; inherit (lib.types) submodule listOf str; in { options.vim.binds.whichKey = { enable = mkEnableOption "which-key keybind helper menu"; register = mkOption { description = "Register label for which-key keybind helper menu"; type = listOf (submodule { options = { keybind = mkOption { type = str; description = "Keybind to register"; }; label = mkOption { type = str; description = "Label for keybind"; }; }; }); default = optionals config.vim.tabline.nvimBufferline.enable [ { keybind = "b"; label = "+Buffer"; } { keybind = "bm"; label = "BufferLineMove"; } { keybind = "bs"; label = "BufferLineSort"; } { keybind = "bsi"; label = "BufferLineSortById"; } ] ++ optionals config.vim.telescope.enable [ { keybind = "f"; label = "+Telescope"; } { keybind = "fl"; label = "Telescope LSP"; } { keybind = "fm"; label = "Cellular Automaton"; } { keybind = "fv"; label = "Telescope Git"; } { keybind = "fvc"; label = "Commits"; } ] ++ optionals config.vim.lsp.trouble.enable [ { keybind = "lw"; label = "Workspace"; } { keybind = "x"; label = "+Trouble"; } { keybind = "l"; label = "Trouble"; } ] ++ optionals config.vim.lsp.nvimCodeActionMenu.enable [ { keybind = "c"; label = "+CodeAction"; } ] ++ optionals (config.vim.minimap.codewindow.enable || config.vim.minimap.minimap-vim.enable) [ { keybind = "m"; label = "+Minimap"; } ] ++ optionals (config.vim.notes.mind-nvim.enable || config.vim.notes.obsidian.enable || config.vim.notes.orgmode.enable) [ { keybind = "o"; label = "+Notes"; } ] ++ optionals config.vim.filetree.nvimTree.enable [ { keybind = "t"; label = "+NvimTree"; } ] ++ optionals config.vim.git.gitsigns.enable [ { keybind = "g"; label = "+Gitsigns"; } ] ++ optionals config.vim.utility.preview.glow.enable [ { keybind = "pm"; label = "+Preview Markdown"; } ]; apply = map (x: {${x.keybind} = {name = x.label;};}); }; }; }