Skip to content

Commit 24c7f4a

Browse files
committed
docs(#2994): update help for visual selection ops
- Fix help-defaults.sh to handle non-normal mode keymaps - Generate help for visual mode API and default keymaps
1 parent 8a069a6 commit 24c7f4a

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

doc/nvim-tree-lua.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ Show the mappings: `g?`
165165
`Y` Copy Relative Path |nvim_tree.api.fs.copy.relative_path()|
166166
`<2-LeftMouse>` Open |nvim_tree.api.node.open.edit()|
167167
`<2-RightMouse>` CD |nvim_tree.api.tree.change_root_to_node()|
168+
169+
`m` Toggle Bookmark |nvim_tree.api.marks.toggle_visual()|
170+
`d` Delete |nvim_tree.api.fs.remove_visual()|
171+
`D` Trash |nvim_tree.api.fs.trash_visual()|
172+
`c` Copy |nvim_tree.api.fs.copy.visual()|
173+
`x` Cut |nvim_tree.api.fs.cut_visual()|
168174

169175
==============================================================================
170176
Quickstart: Custom Mappings *nvim-tree-quickstart-custom-mappings*
@@ -458,6 +464,12 @@ You are encouraged to copy these to your {on_attach} function. >lua
458464
vim.keymap.set("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path"))
459465
vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open"))
460466
vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD"))
467+
468+
vim.keymap.set("x", "m", api.marks.toggle_visual, opts("Toggle Bookmark"))
469+
vim.keymap.set("x", "d", api.fs.remove_visual, opts("Delete"))
470+
vim.keymap.set("x", "D", api.fs.trash_visual, opts("Trash"))
471+
vim.keymap.set("x", "c", api.fs.copy.visual, opts("Copy"))
472+
vim.keymap.set("x", "x", api.fs.cut_visual, opts("Cut"))
461473
-- END_ON_ATTACH_DEFAULT
462474
<
463475
Alternatively, you may apply these default mappings from your
@@ -2461,6 +2473,9 @@ copy.relative_path({node}) *nvim_tree.api.fs.copy.relative_path()*
24612473
Parameters: ~
24622474
{node} (`nvim_tree.api.Node?`)
24632475

2476+
copy.visual() *nvim_tree.api.fs.copy.visual()*
2477+
Copy all visually selected nodes to the nvim-tree clipboard.
2478+
24642479
create({node}) *nvim_tree.api.fs.create()*
24652480
Prompt to create a file or directory.
24662481

@@ -2479,6 +2494,9 @@ cut({node}) *nvim_tree.api.fs.cut()*
24792494
Parameters: ~
24802495
{node} (`nvim_tree.api.Node?`)
24812496

2497+
cut_visual() *nvim_tree.api.fs.cut_visual()*
2498+
Cut all visually selected nodes to the nvim-tree clipboard.
2499+
24822500
paste({node}) *nvim_tree.api.fs.paste()*
24832501
Paste from the nvim-tree clipboard.
24842502

@@ -2496,6 +2514,9 @@ remove({node}) *nvim_tree.api.fs.remove()*
24962514
Parameters: ~
24972515
{node} (`nvim_tree.api.Node?`)
24982516

2517+
remove_visual() *nvim_tree.api.fs.remove_visual()*
2518+
Delete all visually selected nodes, prompting once.
2519+
24992520
rename({node}) *nvim_tree.api.fs.rename()*
25002521
Prompt to rename by name.
25012522

@@ -2532,6 +2553,9 @@ trash({node}) *nvim_tree.api.fs.trash()*
25322553
Parameters: ~
25332554
{node} (`nvim_tree.api.Node?`)
25342555

2556+
trash_visual() *nvim_tree.api.fs.trash_visual()*
2557+
Trash all visually selected nodes, prompting once.
2558+
25352559

25362560
==============================================================================
25372561
API: git *nvim-tree-api-git*
@@ -2609,6 +2633,9 @@ toggle({node}) *nvim_tree.api.marks.toggle()*
26092633
Parameters: ~
26102634
{node} (`nvim_tree.api.Node?`) file or directory
26112635

2636+
toggle_visual() *nvim_tree.api.marks.toggle_visual()*
2637+
Toggle mark on all visually selected nodes.
2638+
26122639

26132640
==============================================================================
26142641
API: node *nvim-tree-api-node*

scripts/help-defaults.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/ON_ATTACH_DEFAULT.lua
4545

4646
# help human
4747
echo > /tmp/ON_ATTACH_DEFAULT.help
48-
sed -E "s/^ *vim.keymap.set\(\"n\", \"(.*)\",.*api(.*),.*opts\(\"(.*)\".*$/'\`\1\`' '\3' '|nvim_tree.api\2()|'/g
48+
sed -E "s/^ *vim.keymap.set\(\".\", \"(.*)\",.*api(.*),.*opts\(\"(.*)\".*$/'\`\1\`' '\3' '|nvim_tree.api\2()|'/g
4949
" /tmp/ON_ATTACH_DEFAULT.lua | while read -r line
5050
do
5151
eval "printf '%-17.17s %-26.26s %s\n' ${line}" >> /tmp/ON_ATTACH_DEFAULT.help

0 commit comments

Comments
 (0)