doc: default mappings

This commit is contained in:
Alexander Courtis
2022-05-30 12:53:28 +10:00
committed by GitHub
parent 5e900c2f29
commit 8198fa01fc
7 changed files with 567 additions and 266 deletions

View File

@@ -468,7 +468,7 @@ Window / buffer setup.
A list of keymaps that will extend or override the default keymaps,
see |nvim-tree-mappings|.
Type: `table`
Default: `{}`
Default: see |nvim-tree-default-mappings|
*nvim-tree.renderer*
UI rendering setup
@@ -543,7 +543,7 @@ UI rendering setup
*nvim-tree.renderer.icons.show.folder_arrow*
Show a small arrow before the folder icon.
Requires |renderer.icons.show.folder| `= true` and |renderer.indent_markers.enable| `= false`
Requires |renderer.icons.show.folder| `= true` and |renderer.indent_markers.enable| `= false`
Type: `boolean`, Default: `true`
*nvim-tree.renderer.icons.show.git*
@@ -737,124 +737,123 @@ Configuration for diagnostic logging.
==============================================================================
INFORMATIONS *nvim-tree-info*
|Mappings| *nvim-tree-mappings*
- type `g?` to see the help UI with keybindings
- move around like in any vim buffer
- `<CR>` on the root folder will cd in the above directory
- typing <C-]> will cd in the directory under the cursor
- typing <BS> will close current opened directory or parent
- typing `P` will move cursor to the parent directory
- type `a` to add a file
- type `r` to rename a file
- type `<C-r>` to rename a file and omit the filename on input
- type `x` to add/remove file/directory to cut clipboard
- type `c` to add/remove file/directory to copy clipboard
- type `p` to paste from clipboard. Cut clipboard has precedence over copy
(will prompt for confirmation)
- type `d` to delete a file (will prompt for confirmation)
- type `]c` to go to next git item
- type `[c` to go to prev git item
- type `-` to navigate up one directory
- type `s` to open a file with default system application or a folder with default file manager
- type `<` to navigate to the previous sibling of current file/directory
- type `>` to navigate to the next sibling of current file/directory
- type `J` to navigate to the first sibling of current file/directory
- type `K` to navigate to the last sibling of current file/directory
- type `<C-e>` to edit the file in place, effectively replacing the tree explorer.
- if the file is a directory, <CR> will open the directory
- otherwise it will open the file in the buffer near the tree
- if the file is a symlink, <CR> will follow the symlink
- <C-v> will open the file in a vertical split
- <C-x> will open the file in a horizontal split
- <C-t> will open the file in a new tab
- <Tab> will open the file as a preview (keeps the cursor in the tree)
- `I` will toggle visibility of files/folders hidden via |git.ignore| option
- `H` will toggle visibility of dotfiles (files/folders starting with a `.`)
- U will toggle visibility of files/folders hidden via |filters.custom| option
- `R` will refresh the tree
- Double left click acts like <CR>
- Double right click acts like <C-]>
- `W` will collapse the whole tree
- `E` will expand the whole tree. Be aware this might hang neovim for a while
if running on a big folder (such as home dir or root dir).
- `S` will prompt the user to enter a path and then expands the tree to match the path
- `.` will enter vim command mode with the file the cursor is on
- `C-k` will toggle a popup with file infos about the file under the cursor
Defaults to:
>
lua <<EOF
local list = {
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
{ key = "<C-e>", action = "edit_in_place" },
{ key = {"O"}, action = "edit_no_picker" },
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
{ key = "<C-v>", action = "vsplit" },
{ key = "<C-x>", action = "split" },
{ key = "<C-t>", action = "tabnew" },
{ key = "<", action = "prev_sibling" },
{ key = ">", action = "next_sibling" },
{ key = "P", action = "parent_node" },
{ key = "<BS>", action = "close_node" },
{ key = "<Tab>", action = "preview" },
{ key = "K", action = "first_sibling" },
{ key = "J", action = "last_sibling" },
{ key = "I", action = "toggle_git_ignored" },
{ key = "H", action = "toggle_dotfiles" },
{ key = "R", action = "refresh" },
{ key = "a", action = "create" },
{ key = "d", action = "remove" },
{ key = "D", action = "trash" },
{ key = "r", action = "rename" },
{ key = "<C-r>", action = "full_rename" },
{ key = "x", action = "cut" },
{ key = "c", action = "copy" },
{ key = "p", action = "paste" },
{ key = "y", action = "copy_name" },
{ key = "Y", action = "copy_path" },
{ key = "gy", action = "copy_absolute_path" },
{ key = "[c", action = "prev_git_item" },
{ key = "]c", action = "next_git_item" },
{ key = "-", action = "dir_up" },
{ key = "s", action = "system_open" },
{ key = "f", action = "live_filter" },
{ key = "F", action = "clear_live_filter" },
{ key = "q", action = "close" },
{ key = "g?", action = "toggle_help" },
{ key = 'W', action = "collapse_all" },
{ key = 'E', action = "expand_all" },
{ key = "S", action = "search_node" },
{ key = ".", action = "run_file_command" },
{ key = "<C-k>", action = "toggle_file_info" }
{ key = "U", action = "toggle_custom" },
}
<
MAPPINGS *nvim-tree-mappings*
The `list` option in `view.mappings.list` is a table of
- key can be either a string or a table of string (lhs)
- action is the name of the action, set to `""` to remove default action
- action_cb is the function that will be called, it receives the node as a parameter. Optional for default actions
- mode is normal by default
- `key` can be either a string or a table of string (lhs)
- `action` is the name of the action, set to `""` to remove default action
- `action_cb` is the function that will be called, it receives the node as a parameter. Optional for default actions
- `mode` is normal by default
>
lua <<EOF
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
local function print_node_path(node) {
print(node.absolute_path)
}
local function print_node_path(node) {
print(node.absolute_path)
}
local list = {
{ key = {"<CR>", "o" }, action = "edit", mode = "n"},
{ key = "p", action = "print_path", action_cb = print_node_path },
{ key = "s", cb = tree_cb("vsplit") }, --tree_cb and the cb property are deprecated
{ key = "<2-RightMouse>", action = "" }, -- will remove default cd action
}
local list = {
{ key = {"<CR>", "o" }, action = "edit", mode = "n"},
{ key = "p", action = "print_path", action_cb = print_node_path },
{ key = "s", cb = tree_cb("vsplit") }, --tree_cb and the cb property are deprecated
{ key = "<2-RightMouse>", action = "" }, -- will remove default cd action
}
<
DEFAULT MAPPINGS *nvim-tree-default-mappings*
`<CR>` edit open a file or folder; root will cd to the above directory
`o`
`<2-LeftMouse>`
`<C-e>` edit_in_place edit the file in place, effectively replacing the tree explorer
`O` edit_no_picker same as (edit) with no window picker
`<C-]>` cd cd in the directory under the cursor
`<2-RightMouse>`
`<C-v>` vsplit open the file in a vertical split
`<C-x>` split open the file in a horizontal split
`<C-t>` tabnew open the file in a new tab
`<` prev_sibling navigate to the previous sibling of current file/directory
`>` next_sibling navigate to the next sibling of current file/directory
`P` parent_node move cursor to the parent directory
`<BS>` close_node close current opened directory or parent
`<Tab>` preview open the file as a preview (keeps the cursor in the tree)
`K` first_sibling navigate to the first sibling of current file/directory
`J` last_sibling navigate to the last sibling of current file/directory
`I` toggle_git_ignored toggle visibility of files/folders hidden via |git.ignore| option
`H` toggle_dotfiles toggle visibility of dotfiles via |filters.dotfiles| option
`U` toggle_custom toggle visibility of files/folders hidden via |filters.custom| option
`R` refresh refresh the tree
`a` create add a file; leaving a trailing `/` will add a directory
`d` remove delete a file (will prompt for confirmation)
`D` trash trash a file via |trash| option
`r` rename rename a file
`<C-r>` full_rename rename a file and omit the filename on input
`x` cut add/remove file/directory to cut clipboard
`c` copy add/remove file/directory to copy clipboard
`p` paste paste from clipboard; cut clipboard has precedence over copy; will prompt for confirmation
`y` copy_name copy name to system clipboard
`Y` copy_path copy relative path to system clipboard
`gy` copy_absolute_path copy absolute path to system clipboard
`[c` prev_git_item go to next git item
`]c` next_git_item go to prev git item
`-` dir_up navigate up to the parent directory of the current file/directory
`s` system_open open a file with default system application or a folder with default file manager, using |system_open| option
`f` live_filter live filter nodes dynamically based on regex matching.
`F` clear_live_filter clear live filter
`q` close close tree window
`W` collapse_all collapse the whole tree
`E` expand_all expand the whole tree, stopping after expanding |actions.expand_all.max_folder_discovery| folders; this might hang neovim for a while if running on a big folder
`S` search_node prompt the user to enter a path and then expands the tree to match the path
`.` run_file_command enter vim command mode with the file the cursor is on
`<C-k>` toggle_file_info toggle a popup with file infos about the file under the cursor
`g?` toggle_help toggle help
|Features| *nvim-tree-features*
>
view.mappings.list = { -- BEGIN_DEFAULT_MAPPINGS
{ key = { "<CR>", "o", "<2-LeftMouse>" }, action = "edit" }
{ key = "<C-e>", action = "edit_in_place" }
{ key = "O", action = "edit_no_picker" }
{ key = { "<C-]>", "<2-RightMouse>" }, action = "cd" }
{ key = "<C-v>", action = "vsplit" }
{ key = "<C-x>", action = "split" }
{ key = "<C-t>", action = "tabnew" }
{ key = "<", action = "prev_sibling" }
{ key = ">", action = "next_sibling" }
{ key = "P", action = "parent_node" }
{ key = "<BS>", action = "close_node" }
{ key = "<Tab>", action = "preview" }
{ key = "K", action = "first_sibling" }
{ key = "J", action = "last_sibling" }
{ key = "I", action = "toggle_git_ignored" }
{ key = "H", action = "toggle_dotfiles" }
{ key = "U", action = "toggle_custom" }
{ key = "R", action = "refresh" }
{ key = "a", action = "create" }
{ key = "d", action = "remove" }
{ key = "D", action = "trash" }
{ key = "r", action = "rename" }
{ key = "<C-r>", action = "full_rename" }
{ key = "x", action = "cut" }
{ key = "c", action = "copy" }
{ key = "p", action = "paste" }
{ key = "y", action = "copy_name" }
{ key = "Y", action = "copy_path" }
{ key = "gy", action = "copy_absolute_path" }
{ key = "[c", action = "prev_git_item" }
{ key = "]c", action = "next_git_item" }
{ key = "-", action = "dir_up" }
{ key = "s", action = "system_open" }
{ key = "f", action = "live_filter" }
{ key = "F", action = "clear_live_filter" }
{ key = "q", action = "close" }
{ key = "W", action = "collapse_all" }
{ key = "E", action = "expand_all" }
{ key = "S", action = "search_node" }
{ key = ".", action = "run_file_command" }
{ key = "<C-k>", action = "toggle_file_info" }
{ key = "g?", action = "toggle_help" }
} -- END_DEFAULT_MAPPINGS
<
FEATURES *nvim-tree-features*
File icons with vim-devicons.