diff options
Diffstat (limited to 'lua/core/which-key.lua')
-rw-r--r-- | lua/core/which-key.lua | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 96f3a8f7..71c0b695 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -1,8 +1,10 @@ local M = {} -local Log = require "core.log" + M.config = function() lvim.builtin.which_key = { - active = false, + ---@usage disable which-key completely [not recommeded] + active = true, + on_config_done = nil, setup = { plugins = { marks = true, -- shows a list of your marks on ' and ` @@ -66,7 +68,6 @@ M.config = function() ["q"] = { "<cmd>q!<CR>", "Quit" }, ["/"] = { "<cmd>CommentToggle<CR>", "Comment" }, ["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" }, - ["e"] = { "<cmd>lua require'core.nvimtree'.toggle_tree()<CR>", "Explorer" }, ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" }, ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" }, b = { @@ -169,6 +170,18 @@ M.config = function() }, L = { name = "+LunarVim", + c = { + "<cmd>edit ~/.config/lvim/config.lua<cr>", + "Edit config.lua", + }, + f = { + "<cmd>lua require('core.telescope').find_lunarvim_files()<cr>", + "Find LunarVim files", + }, + g = { + "<cmd>lua require('core.telescope').grep_lunarvim_files()<cr>", + "Grep LunarVim files", + }, k = { "<cmd>lua require('keymappings').print()<cr>", "View LunarVim's default keymappings" }, i = { "<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>", @@ -218,14 +231,7 @@ M.config = function() end M.setup = function() - -- if not package.loaded['which-key'] then - -- return - -- end - local status_ok, which_key = pcall(require, "which-key") - if not status_ok then - Log:get_default "Failed to load whichkey" - return - end + local which_key = require "which-key" which_key.setup(lvim.builtin.which_key.setup) @@ -235,10 +241,12 @@ M.setup = function() local mappings = lvim.builtin.which_key.mappings local vmappings = lvim.builtin.which_key.vmappings - local wk = require "which-key" + which_key.register(mappings, opts) + which_key.register(vmappings, vopts) - wk.register(mappings, opts) - wk.register(vmappings, vopts) + if lvim.builtin.which_key.on_config_done then + lvim.builtin.which_key.on_config_done(which_key) + end end return M |