feat: add vinegar abilities to the tree

fixes #860
This commit is contained in:
kiyan
2022-02-21 21:42:43 +01:00
parent f977e5c05a
commit f8f297acbf
6 changed files with 84 additions and 11 deletions

View File

@@ -585,7 +585,7 @@ INFORMATIONS *nvim-tree-info*
- 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
@@ -605,6 +605,7 @@ 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" },
@@ -745,7 +746,42 @@ NvimTreeFileNew
NvimTreeFileDeleted
==============================================================================
EVENTS *nvim-tree-events*
vinegar style *nvim-tree-vinegar*
|nvim_tree_vinegar| *nvim_tree_vinegar*
nvim-tree can behave like vinegar. To allow this, you will need to configure
it in a specific way:
- Use `require"nvim-tree".open_replacing_current_buffer()` instead of the
default open command.
You can easily implement a toggle using this too:
>
local function toggle_replace()
local view = require"nvim-tree.view"
if view.is_visible() then
require.close()
else
require"nvim-tree".open_replacing_current_buffer()
end
end
<
- Use the `edit_in_place` action to edit files. It's bound to `<C-e>` by
default, vinegar uses `-`. You can override this with:
>
require"nvim-tree".setup {
view = {
mappings = {
{ key = "-", action = "edit_in_place" }
}
}
}
<
You'll also need to set |nvim-tree.hijack_netrw| to `true` during setup.
A good functionnality to enable is |nvim-tree.hijack_directories|.
==============================================================================
events *nvim-tree-events*
|nvim_tree_events| *nvim_tree_events*