diff options
Diffstat (limited to 'lua/core/which-key.lua')
-rw-r--r-- | lua/core/which-key.lua | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index c3255705..9d4e7744 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -1,6 +1,6 @@ local M = {} M.config = function() - O.plugin.which_key = { + lvim.builtin.which_key = { active = false, setup = { plugins = { @@ -64,16 +64,38 @@ M.config = function() ["w"] = { "<cmd>w!<CR>", "Save" }, ["q"] = { "<cmd>q!<CR>", "Quit" }, ["/"] = { "<cmd>CommentToggle<CR>", "Comment" }, - ["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" }, + ["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>let @/=""<CR>', "No Highlight" }, - [";"] = { "<cmd>Dashboard<CR>", "Dashboard" }, + b = { + name = "Buffers", + j = { "<cmd>BufferPick<cr>", "jump to buffer" }, + f = { "<cmd>Telescope buffers<cr>", "Find buffer" }, + w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" }, + e = { + "<cmd>BufferCloseAllButCurrent<cr>", + "close all but current buffer", + }, + h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" }, + l = { + "<cmd>BufferCloseBuffersRight<cr>", + "close all BufferLines to the right", + }, + D = { + "<cmd>BufferOrderByDirectory<cr>", + "sort BufferLines automatically by directory", + }, + L = { + "<cmd>BufferOrderByLanguage<cr>", + "sort BufferLines automatically by language", + }, + }, p = { name = "Packer", c = { "<cmd>PackerCompile<cr>", "Compile" }, i = { "<cmd>PackerInstall<cr>", "Install" }, - r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" }, + r = { "<cmd>lua require('utils').reload_lv_config()<cr>", "Reload" }, s = { "<cmd>PackerSync<cr>", "Sync" }, u = { "<cmd>PackerUpdate<cr>", "Update" }, }, @@ -118,19 +140,21 @@ M.config = function() "<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics", }, - f = { "<cmd>silent FormatWrite<cr>", "Format" }, + -- f = { "<cmd>silent FormatWrite<cr>", "Format" }, + f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" }, i = { "<cmd>LspInfo<cr>", "Info" }, j = { - "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", + "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<cr>", "Next Diagnostic", }, k = { - "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", + "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<cr>", "Prev Diagnostic", }, + l = { "<cmd>silent lua require('lint').try_lint()<cr>", "Lint" }, q = { "<cmd>Telescope quickfix<cr>", "Quickfix" }, r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, - s = { "<cmd> Telescope lsp_document_symbols<cr>", "Document Symbols" }, + s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" }, S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols", @@ -149,6 +173,10 @@ M.config = function() t = { "<cmd>Telescope live_grep<cr>", "Text" }, k = { "<cmd>Telescope keymaps<cr>", "Keymaps" }, C = { "<cmd>Telescope commands<cr>", "Commands" }, + p = { + "<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<cr>", + "Colorscheme with Preview", + }, }, T = { name = "Treesitter", @@ -167,29 +195,18 @@ M.setup = function() return end - which_key.setup(O.plugin.which_key.setup) - - local opts = O.plugin.which_key.opts - local vopts = O.plugin.which_key.vopts + which_key.setup(lvim.builtin.which_key.setup) - local mappings = O.plugin.which_key.mappings - local vmappings = O.plugin.which_key.vmappings + local opts = lvim.builtin.which_key.opts + local vopts = lvim.builtin.which_key.vopts - -- if O.plugin.ts_playground.active then - -- vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true }) - -- mappings[""] = "Highlight Capture" - -- end - - if O.plugin.zen.active then - vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true }) - mappings["z"] = "Zen" - end + local mappings = lvim.builtin.which_key.mappings + local vmappings = lvim.builtin.which_key.vmappings local wk = require "which-key" wk.register(mappings, opts) wk.register(vmappings, vopts) - wk.register(O.user_which_key, opts) end return M |