Skip to content

Commit ccde05e

Browse files
committed
feat(treewalker): update keybindings for navigation
- Changed keybindings for navigating tree structure. - Users can now use arrow keys for sibling and parent navigation. - Introduced 'z' prefix for swap actions to avoid conflicts. - Updated documentation to reflect new keybindings.
1 parent 74ca0d4 commit ccde05e

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

lua/plugins/treewalker.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ return {
77
local tw = require("treewalker")
88

99
local keymaps = {
10-
{ "<c-j>", tw.move_down, "Jump to next sibling node", { mode = { "n", "v" } } },
11-
{ "<c-k>", tw.move_up, "Jump to previous sibling node", { mode = { "n", "v" } } },
12-
{ "<c-h>", tw.move_out, "Jump to parent", { mode = { "n", "v" } } },
13-
{ "<c-l>", tw.move_in, "Jump to child", { mode = { "n", "v" } } },
14-
{ "<m-k>", tw.swap_up, "Swap up" },
15-
{ "<m-j>", tw.swap_down, "Swap down" },
16-
{ "<m-h>", tw.swap_left, "Swap left" },
17-
{ "<m-l>", tw.swap_right, "Swap right" },
10+
{ "`<down>", tw.move_down, "Jump to next sibling node", { mode = { "n", "v" } } },
11+
{ "`<up>", tw.move_up, "Jump to previous sibling node", { mode = { "n", "v" } } },
12+
{ "`<left>", tw.move_out, "Jump to parent", { mode = { "n", "v" } } },
13+
{ "`<right>", tw.move_in, "Jump to child", { mode = { "n", "v" } } },
14+
{ "`k", tw.swap_up, "Swap up" },
15+
{ "`j", tw.swap_down, "Swap down" },
16+
{ "`h", tw.swap_left, "Swap left" },
17+
{ "`l", tw.swap_right, "Swap right" },
1818
}
1919

2020
return vim.fn.get_lazy_keys_conf(keymaps, "AST")

readme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ Random features added.
288288

289289
### Syntax (AST)
290290

291-
- `<c-h>` jump to parent node
292-
- `<c-j>` jump to next sibling node
293-
- `<c-k>` jump to previous sibling node
294-
- `<c-l>` jump to child node
295-
- `<m-h>` swap with lateral previous node
296-
- `<m-j>` swap with vertical next node
297-
- `<m-k>` swap with vertical previous node
298-
- `<m-l>` swap with lateral next node
291+
- ``<left>` jump to parent node
292+
- ``<down>` jump to next sibling node
293+
- ``<up>` jump to previous sibling node
294+
- ``<down>` jump to child node
295+
- ``h` swap with lateral previous node
296+
- ``j` swap with vertical next node
297+
- ``k` swap with vertical previous node
298+
- ``l` swap with lateral next node
299299
- `<leader>v` select current node
300300
- `;` increase selection (on node selection mode)
301301
- `,` decrease selection (on node selection mode)

0 commit comments

Comments
 (0)