From 7e3e57940b5189bae464b139bf50151451ad93d2 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sat, 8 Feb 2025 21:09:58 -0500 Subject: [PATCH] add floating-help opts --- lua/data/types.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lua/data/types.lua b/lua/data/types.lua index 3fe12a2..86b9df7 100644 --- a/lua/data/types.lua +++ b/lua/data/types.lua @@ -451,6 +451,37 @@ M.flash = { modes = { char = { jump_labels = true } }, } +M.floating_help = { + opts = { + width = 0.8, -- Whole numbers are columns/rows + height = 0.9, -- Decimals are a percentage of the editor + position = 'C', -- NW,N,NW,W,C,E,SW,S,SE (C==center) + border = 'rounded', -- rounded,double,single + }, + init = function() + vim.g.floating_help = true + -- Only replace cmds, not search; only replace the first instance + --- Replace commands in the form of 'cabbr ' + ---@param abbrev string The abbreviation to replace + ---@param expansion string The expansion to replace it with + local function cmd_abbrev(abbrev, expansion) + local cmd = 'cabbr ' + .. abbrev + .. ' =(getcmdpos() == 1 && getcmdtype() == ":" ? "' + .. expansion + .. '" : "' + .. abbrev + .. '")' + vim.cmd(cmd) + end + -- Replace native help commands with floating help + cmd_abbrev('h', 'FloatingHelp') + cmd_abbrev('help', 'FloatingHelp') + cmd_abbrev('helpc', 'FloatingHelpClose') + cmd_abbrev('helpclose', 'FloatingHelpClose') + end, +} + --- Smart-Scrolloff configuration options M.smartscrolloff = { scrolloff_percentage = 0.25 }