home: vim: add statement objects/moves

And document it.
This commit is contained in:
Bruno BELANYI 2022-02-26 19:52:40 +01:00
parent 56554f1a7a
commit 8b84ab8625
2 changed files with 6 additions and 0 deletions

View file

@ -4,10 +4,12 @@ local wk = require("which-key")
local motions = { local motions = {
["]m"] = "Next method start", ["]m"] = "Next method start",
["]M"] = "Next method end", ["]M"] = "Next method end",
["]S"] = "Next statement start",
["]]"] = "Next class start", ["]]"] = "Next class start",
["]["] = "Next class end", ["]["] = "Next class end",
["[m"] = "Previous method start", ["[m"] = "Previous method start",
["[M"] = "Previous method end", ["[M"] = "Previous method end",
["[S"] = "Previous statement start",
["[["] = "Previous class start", ["[["] = "Previous class start",
["[]"] = "Previous class end", ["[]"] = "Previous class end",
} }
@ -22,6 +24,7 @@ local objects = {
["af"] = "a function", ["af"] = "a function",
["if"] = "inner function", ["if"] = "inner function",
["ak"] = "a comment", ["ak"] = "a comment",
["aS"] = "a statement",
} }
wk.register(motions, { mode = "n" }) wk.register(motions, { mode = "n" })

View file

@ -24,6 +24,7 @@ ts_config.setup({
["af"] = "@function.outer", ["af"] = "@function.outer",
["if"] = "@function.inner", ["if"] = "@function.inner",
["ak"] = "@comment.outer", ["ak"] = "@comment.outer",
["aS"] = "@statement.outer",
}, },
}, },
move = { move = {
@ -32,6 +33,7 @@ ts_config.setup({
set_jumps = true, set_jumps = true,
goto_next_start = { goto_next_start = {
["]m"] = "@function.outer", ["]m"] = "@function.outer",
["]S"] = "@statement.outer",
["]]"] = "@class.outer", ["]]"] = "@class.outer",
}, },
goto_next_end = { goto_next_end = {
@ -40,6 +42,7 @@ ts_config.setup({
}, },
goto_previous_start = { goto_previous_start = {
["[m"] = "@function.outer", ["[m"] = "@function.outer",
["[S"] = "@statement.outer",
["[["] = "@class.outer", ["[["] = "@class.outer",
}, },
goto_previous_end = { goto_previous_end = {