Skip to content

Commit ca8052f

Browse files
committed
feat(nvim): new plugin FloatingHelp
1 parent b3da612 commit ca8052f

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

nvim/lua/plugins/floating-help.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
return {
2+
"Tyler-Barham/floating-help.nvim",
3+
4+
config = function()
5+
local fh = require("floating-help")
6+
7+
fh.setup()
8+
9+
-- Only replace cmds, not search; only replace the first instance
10+
local function cmd_abbrev(abbrev, expansion)
11+
local cmd = "cabbr "
12+
.. abbrev
13+
.. ' <c-r>=(getcmdpos() == 1 && getcmdtype() == ":" ? "'
14+
.. expansion
15+
.. '" : "'
16+
.. abbrev
17+
.. '")<CR>'
18+
vim.cmd(cmd)
19+
end
20+
21+
-- Redirect `:h` to `:FloatingHelp`
22+
cmd_abbrev("h", "FloatingHelp")
23+
cmd_abbrev("help", "FloatingHelp")
24+
cmd_abbrev("helpc", "FloatingHelpClose")
25+
cmd_abbrev("helpclose", "FloatingHelpClose")
26+
end,
27+
28+
keys = {
29+
{
30+
"<leader>H",
31+
":FloatingHelp<cr>",
32+
desc = "Display help",
33+
},
34+
},
35+
}

0 commit comments

Comments
 (0)