Nvim : Add Leader before Macro to enable marks.

This commit is contained in:
Dmitry Voronin 2024-01-06 14:38:01 +03:00
parent 221ffe68ca
commit 26050f1578

View file

@ -1,63 +1,59 @@
require("key/Rekey")
-- wraps.
rekey_visual("mwx", "s<delete><backspace><esc>p") -- unwrap once (select only stuff inside).
rekey_visual("mw\"", "s\"\"<esc>P") -- wrap in "".
rekey_visual("mw3\"", "s\"\"\"\"\"\"<esc>hhP") -- wrap in 3x "".
rekey_visual("mw'", "s''<esc>P") -- wrap in "".
rekey_visual("mw(", "s()<esc>P") -- wrap in ().
rekey_visual("mw)", "s()<esc>P") -- wrap in ().
rekey_visual("mw{", "s{}<esc>P") -- wrap in {}.
rekey_visual("mw}", "s{}<esc>P") -- wrap in {}.
rekey_visual("mw<", "s<><esc>P") -- wrap in {}.
rekey_visual("mw>", "s<><esc>P") -- wrap in {}.
rekey_visual("mw[", "s[]<esc>P") -- wrap in [].
rekey_visual("mw]", "s[]<esc>P") -- wrap in [].
rekey_visual("mw`", "s``<esc>P") -- wrap in ``.
rekey_visual("mw3`", "s``````<esc>hhP") -- wrap in 3x ``.
rekey_visual("mw*", "s**<esc>P") -- wrap in **.
rekey_visual("mw2*", "s****<esc>hP") -- wrap in 2x **.
rekey_visual("mw3*", "s******<esc>hhP") -- wrap in 3x **.
rekey_visual("mw ", "s <esc>P") -- wrap in spaces.
rekey_visual("<Leader>mwx", "s<delete><backspace><esc>p") -- unwrap once (select only stuff inside).
rekey_visual("<Leader>mw\"", "s\"\"<esc>P") -- wrap in "".
rekey_visual("<Leader>mw3\"", "s\"\"\"\"\"\"<esc>hhP") -- wrap in 3x "".
rekey_visual("<Leader>mw'", "s''<esc>P") -- wrap in "".
rekey_visual("<Leader>mw(", "s()<esc>P") -- wrap in ().
rekey_visual("<Leader>mw)", "s()<esc>P") -- wrap in ().
rekey_visual("<Leader>mw{", "s{}<esc>P") -- wrap in {}.
rekey_visual("<Leader>mw}", "s{}<esc>P") -- wrap in {}.
rekey_visual("<Leader>mw<", "s<><esc>P") -- wrap in {}.
rekey_visual("<Leader>mw>", "s<><esc>P") -- wrap in {}.
rekey_visual("<Leader>mw[", "s[]<esc>P") -- wrap in [].
rekey_visual("<Leader>mw]", "s[]<esc>P") -- wrap in [].
rekey_visual("<Leader>mw`", "s``<esc>P") -- wrap in ``.
rekey_visual("<Leader>mw3`", "s``````<esc>hhP") -- wrap in 3x ``.
rekey_visual("<Leader>mw*", "s**<esc>P") -- wrap in **.
rekey_visual("<Leader>mw2*", "s****<esc>hP") -- wrap in 2x **.
rekey_visual("<Leader>mw3*", "s******<esc>hhP") -- wrap in 3x **.
rekey_visual("<Leader>mw ", "s <esc>P") -- wrap in spaces.
-- rewraps. <delete><backspace>
rekey_visual("mwrx", "s<delete><backspace><delete><backspace><esc>p") -- unwrap once (select only stuff inside).
rekey_visual("mwr\"", "s<delete><backspace>\"\"<esc>P") -- wrap in "".
rekey_visual("mwr3\"", "s<delete><backspace>\"\"\"\"\"\"<esc>hhP") -- wrap in 3x "".
rekey_visual("mwr'", "s<delete><backspace>''<esc>P") -- wrap in "".
rekey_visual("mwr(", "s<delete><backspace>()<esc>P") -- wrap in ().
rekey_visual("mwr)", "s<delete><backspace>()<esc>P") -- wrap in ().
rekey_visual("mwr{", "s<delete><backspace>{}<esc>P") -- wrap in {}.
rekey_visual("mwr}", "s<delete><backspace>{}<esc>P") -- wrap in {}.
rekey_visual("mwr<", "s<delete><backspace><><esc>P") -- wrap in {}.
rekey_visual("mwr>", "s<delete><backspace><><esc>P") -- wrap in {}.
rekey_visual("mwr[", "s<delete><backspace>[]<esc>P") -- wrap in [].
rekey_visual("mwr]", "s<delete><backspace>[]<esc>P") -- wrap in [].
rekey_visual("mwr`", "s<delete><backspace>``<esc>P") -- wrap in ``.
rekey_visual("mwr3`", "s<delete><backspace>``````<esc>hhP") -- wrap in 3x ``.
rekey_visual("mwr*", "s<delete><backspace>**<esc>P") -- wrap in **.
rekey_visual("mwr2*", "s<delete><backspace>****<esc>hP") -- wrap in 2x **.
rekey_visual("mwr3*", "s<delete><backspace>******<esc>hhP") -- wrap in 3x **.
rekey_visual("mwr ", "s<delete><backspace> <esc>P") -- wrap in spaces.
rekey_visual("<Leader>mwrx", "s<delete><backspace><delete><backspace><esc>p") -- unwrap once (select only stuff inside).
rekey_visual("<Leader>mwr\"", "s<delete><backspace>\"\"<esc>P") -- wrap in "".
rekey_visual("<Leader>mwr3\"", "s<delete><backspace>\"\"\"\"\"\"<esc>hhP") -- wrap in 3x "".
rekey_visual("<Leader>mwr'", "s<delete><backspace>''<esc>P") -- wrap in "".
rekey_visual("<Leader>mwr(", "s<delete><backspace>()<esc>P") -- wrap in ().
rekey_visual("<Leader>mwr)", "s<delete><backspace>()<esc>P") -- wrap in ().
rekey_visual("<Leader>mwr{", "s<delete><backspace>{}<esc>P") -- wrap in {}.
rekey_visual("<Leader>mwr}", "s<delete><backspace>{}<esc>P") -- wrap in {}.
rekey_visual("<Leader>mwr<", "s<delete><backspace><><esc>P") -- wrap in {}.
rekey_visual("<Leader>mwr>", "s<delete><backspace><><esc>P") -- wrap in {}.
rekey_visual("<Leader>mwr[", "s<delete><backspace>[]<esc>P") -- wrap in [].
rekey_visual("<Leader>mwr]", "s<delete><backspace>[]<esc>P") -- wrap in [].
rekey_visual("<Leader>mwr`", "s<delete><backspace>``<esc>P") -- wrap in ``.
rekey_visual("<Leader>mwr3`", "s<delete><backspace>``````<esc>hhP") -- wrap in 3x ``.
rekey_visual("<Leader>mwr*", "s<delete><backspace>**<esc>P") -- wrap in **.
rekey_visual("<Leader>mwr2*", "s<delete><backspace>****<esc>hP") -- wrap in 2x **.
rekey_visual("<Leader>mwr3*", "s<delete><backspace>******<esc>hhP") -- wrap in 3x **.
rekey_visual("<Leader>mwr ", "s<delete><backspace> <esc>P") -- wrap in spaces.
-- markdown.
rekey_normal("mmx", ":s/- \\[ \\]/- \\[x\\]<C-l>/<cr>") -- mark checkbox.
rekey_normal("mm ", ":s/- \\[x\\]/- \\[ \\]<C-l>/<cr>") -- unmark checkbox.
rekey_visual("mmx", ":s/- \\[ \\]/- \\[x\\]<C-l>/<cr>") -- mark checkbox (multiline select),
rekey_visual("mm ", ":s/- \\[x\\]/- \\[ \\]<C-l>/<cr>") -- unmark checkbox (multiline select).
rekey_normal("mmp", "I  <esc>") -- insert paragraph (indent).
rekey_visual("mmb", "s****<esc>hP") -- make bold.
rekey_visual("mmi", "s**<esc>P") -- make italic.
rekey_visual("mms", "s~~~~<esc>hP") -- make strikethrough.
rekey_visual("mmr", "s``<esc>P") -- wrap in `` (reference).
rekey_visual("mmc", "s``````<esc>hhPa<cr><cr><esc><up>") -- wrap in 3x `` (code).
-- rekey_visual("mm>", ":s/^")
-- rekey_visual("mm<", "")
-- rekey_normal("mm>", "")
-- rekey_normal("mm<", "")
rekey_normal("<Leader>mmx", ":s/- \\[ \\]/- \\[x\\]<C-l>/<cr>") -- mark checkbox.
rekey_normal("<Leader>mm ", ":s/- \\[x\\]/- \\[ \\]<C-l>/<cr>") -- unmark checkbox.
rekey_visual("<Leader>mmx", ":s/- \\[ \\]/- \\[x\\]<C-l>/<cr>") -- mark checkbox (multiline select),
rekey_visual("<Leader>mm ", ":s/- \\[x\\]/- \\[ \\]<C-l>/<cr>") -- unmark checkbox (multiline select).
rekey_normal("<Leader>mmp", "I  <esc>") -- insert paragraph (indent).
rekey_visual("<Leader>mmb", "s****<esc>hP") -- make bold.
rekey_visual("<Leader>mmi", "s**<esc>P") -- make italic.
rekey_visual("<Leader>mms", "s~~~~<esc>hP") -- make strikethrough.
rekey_visual("<Leader>mmr", "s``<esc>P") -- wrap in `` (reference).
rekey_visual("<Leader>mmc", "s``````<esc>hhPa<cr><cr><esc><up>") -- wrap in 3x `` (code).
-- increment.
rekey_normal("mi", "<C-a>yyup<C-o>j") -- copy line and increment number under cursor.
rekey_normal("<Leader>mi", "<C-a>yyup<C-o>j") -- copy line and increment number under cursor.
-- select.
rekey_normal("ma", "ggVG") -- select all.
rekey_normal("<Leader>ma", "ggVG") -- select all.