diff --git a/lua/nami/remap.lua b/lua/nami/remap.lua index 238d7e1..b9172ab 100644 --- a/lua/nami/remap.lua +++ b/lua/nami/remap.lua @@ -70,6 +70,30 @@ vim.keymap.set("x", "p", "\"_dp") -- Paste after without moving selectio ------------ -- Macros -- ------------ +-- Create a header in this form: +-- ######## +-- # Text # +-- ######## +-- Use it like so: +-- Text +-- # (Border line, place your cursor here +-- Run Macro +vim.keymap.set("n", "h", "0\"xy$k\"xPa A \"xpyyP:s;.;x;gj$k$olkdyyjpj\"_dd") +-- How it works: +-- 0\"xy$k\"xPa A \"xpyyP:s;.;x;gj$k$olkdyyjpj\"_dd +-- ^ +-- - yank text on line into register x +-- - paste it before and after the line aboth +-- 0\"xy$k\"xPa A \"xpyyP:s;.;x;gj$k$olkdyyjpj\"_dd +-- ^ +-- - yank the text line and paste it aboth +-- - substitute every character with the filler text: :s;.;x:g ( = read register) +-- 0\"xy$k\"xPa A \"xpyyP:s;.;x;gj$k$olkdyyjpj\"_dd +-- ^ +-- - with visual block make both line equal length +-- - make a copy of the upper line and paste it below +-- - delete the left over line + -- format a markdown table inside visual selection vim.keymap.set("v", "mt", ":!column -t -s '|' -o '|'", { desc = "Format markdown table" })