From e433ff0b23a8e5dad3b4d2faa5be14601bf0b2af Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Tue, 11 Feb 2025 18:08:33 +0100 Subject: [PATCH] fix(mappings): use :help in vim/help filetypes when pressing K, :Man for others --- lua/core/mappings.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index c6daad4..0e468ac 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -47,7 +47,13 @@ vim.keymap.set({"x"}, ">", ">gv") -- Remove default mappings vim.keymap.set("", "", "") -vim.keymap.set({ "n", }, "K", ':Man "*"') +vim.keymap.set('n', 'K', function() + if vim.bo.filetype == 'vim' or vim.bo.filetype == 'help' then + vim.cmd('help ' .. vim.fn.expand('')) + else + vim.cmd('Man ' .. vim.fn.expand('')) + end +end) -- Remove right-click menu items vim.cmd.aunmenu({ "PopUp.-1-", })