This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/nvim/lua/key/macro.lua

39 lines
2 KiB
Lua
Raw Normal View History

2023-08-08 16:24:15 +03:00
require("key/rekey")
-- wraps.
rekey_visual("mwx", "s<delete><backspace><esc>p") -- unwrap once (select only stuff inside).
2023-10-30 00:19:01 +03:00
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("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 **.
2023-08-08 16:24:15 +03:00
-- markdown.
2023-10-30 00:19:01 +03:00
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<", "")
2023-08-08 16:24:15 +03:00
-- increment.
2023-10-30 00:19:01 +03:00
rekey_normal("mi", "<C-a>yyup<C-o>j") -- copy line and increment number under cursor.
2023-08-08 16:24:15 +03:00
-- select.
2023-10-30 00:19:01 +03:00
rekey_normal("ma", "ggVG") -- select all.