feat: reload explorer on buf enter (#1265)
This commit is contained in:
@@ -128,6 +128,7 @@ require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS
|
|||||||
open_on_tab = false,
|
open_on_tab = false,
|
||||||
sort_by = "name",
|
sort_by = "name",
|
||||||
update_cwd = false,
|
update_cwd = false,
|
||||||
|
reload_on_bufenter = false,
|
||||||
view = {
|
view = {
|
||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
height = 30,
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ Values may be functions. Warning: this may result in unexpected behaviour.
|
|||||||
open_on_tab = false,
|
open_on_tab = false,
|
||||||
sort_by = "name",
|
sort_by = "name",
|
||||||
update_cwd = false,
|
update_cwd = false,
|
||||||
|
reload_on_bufenter = false,
|
||||||
view = {
|
view = {
|
||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
height = 30,
|
||||||
@@ -263,6 +264,10 @@ Keeps the cursor on the first letter of the filename when moving in the tree.
|
|||||||
Changes the tree root directory on `DirChanged` and refreshes the tree.
|
Changes the tree root directory on `DirChanged` and refreshes the tree.
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
|
*nvim-tree.reload_on_bufenter*
|
||||||
|
Automatically reloads the tree on `BufEnter` nvim-tree.
|
||||||
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.hijack_directories*
|
*nvim-tree.hijack_directories*
|
||||||
hijacks new directory buffers when they are opened (`:e dir`).
|
hijacks new directory buffers when they are opened (`:e dir`).
|
||||||
|
|
||||||
|
|||||||
@@ -336,6 +336,10 @@ local function setup_autocommands(opts)
|
|||||||
if opts.hijack_directories.enable then
|
if opts.hijack_directories.enable then
|
||||||
create_nvim_tree_autocmd({ "BufEnter", "BufNewFile" }, { callback = M.open_on_directory })
|
create_nvim_tree_autocmd({ "BufEnter", "BufNewFile" }, { callback = M.open_on_directory })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.reload_on_bufenter then
|
||||||
|
create_nvim_tree_autocmd("BufEnter", { pattern = "NvimTree_*", callback = reloaders.reload_explorer })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
||||||
@@ -350,6 +354,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
|||||||
open_on_tab = false,
|
open_on_tab = false,
|
||||||
sort_by = "name",
|
sort_by = "name",
|
||||||
update_cwd = false,
|
update_cwd = false,
|
||||||
|
reload_on_bufenter = false,
|
||||||
view = {
|
view = {
|
||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
height = 30,
|
||||||
|
|||||||
Reference in New Issue
Block a user