doc(#1676): clarify view.mapping.list contents including case of key

This commit is contained in:
Alexander Courtis
2022-10-25 09:37:02 +11:00
parent 49c32c0dda
commit 1be1e17be5

View File

@@ -1173,14 +1173,24 @@ exists.
============================================================================== ==============================================================================
6. MAPPINGS *nvim-tree-mappings* 6. MAPPINGS *nvim-tree-mappings*
Setting your own mapping in the configuration will soon be deprecated, see |nvim-tree.on_attach| for experimental replacement. Setting your own mapping in the configuration will soon be deprecated, see
|nvim-tree.on_attach| for experimental replacement.
The `list` option in `view.mappings.list` is a table of `view.mappings.list` is a table of:
{key} (string|table of string) mandatory |{lhs}|.
- `key` (mandatory) string or a table of string {action} (string) mandatory name of the action.
- `action` (mandatory) is the name of the action, set to `""` to remove default action, set to an arbitrary description when using `action_cb` `""` to remove an action with {key}. The case of {key} must
- `action_cb` (optional) is a custom function that will be called, it receives the node as a parameter. exactly match the action you are removing e.g. `'<Tab>'` to
- `mode` (optional) is `n` by default remove the default preview action.
An arbitrary description when using `action_cb`.
{action_cb} (function) optional custom function that will be called.
Receives the node as a parameter.
Non-empty description for `action` is required.
{mode} (string) optional mode as per |nvim_set_keymap|.
Default `'n'`.
Examples: Examples:
> >
@@ -1194,7 +1204,7 @@ Examples:
mappings = { mappings = {
list = { list = {
-- remove a default mapping for cd -- remove a default mapping for cd
{ key = "<2-RightMouse>", action = "" }, -- will remove default cd action { key = "<2-RightMouse>", action = "" },
-- add multiple normal mode mappings for edit -- add multiple normal mode mappings for edit
{ key = { "<CR>", "o" }, action = "edit", mode = "n" }, { key = { "<CR>", "o" }, action = "edit", mode = "n" },