feat: conditionally write which-key registers

This commit is contained in:
NotAShelf 2023-02-17 13:49:29 +03:00
commit b4027c4bba
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
4 changed files with 111 additions and 51 deletions

View file

@ -1,22 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.cheatsheet;
in {
options.vim.binds.cheatsheet = {
enable = mkEnableOption "Searchable cheatsheet for nvim using telescope";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["cheatsheet-nvim"];
vim.luaConfigRC.cheaetsheet-nvim = nvim.dag.entryAnywhere ''
require('cheatsheet').setup({})
'';
};
}

View file

@ -1,11 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./which-key.nix
./cheatsheet.nix
];
}

View file

@ -1,49 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.whichKey;
in {
options.vim.binds.whichKey = {
enable = mkEnableOption "which-key menu";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''
require("which-key").setup {}
local wk = require("which-key")
wk.register({
["<leader>b"] = { name = "+Buffer" },
["<leader>c"] = { name = "+CodeAction" },
["<leader>b"] = { name = "+Buffer" },
["<leader>f"] = { name = "+Telescope" },
["<leader>m"] = { name = "+Minimap" },
["<leader>o"] = { name = "+Notes" },
["<leader>t"] = { name = "+NvimTree" },
["<leader>x"] = { name = "+Trouble" }, -- TODO: move all trouble binds to the same parent group
["<leader>l"] = { name = "+Trouble" },
-- Buffer
["<leader>bm"] = { name = "BufferLineMove" },
["<leader>bm"] = { name = "BufferLineSort" },
-- Telescope
["<leader>fl"] = { name = "Telescope LSP" },
["<leader>fm"] = { name = "Cellular Automaton" }, -- TODO: mvoe this to its own parent group
["<leader>fv"] = { name = "Telescope Git" },
["<leader>fvc"] = { name = "Commits" },
-- Trouble
["<leader>lw"] = { name = "Workspace" },
})
'';
};
}