Skip to content

Commit fb775b3

Browse files
authored
feat(view): deprecate open_on_setup.* in favour of https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup (#1951)
1 parent e14989c commit fb775b3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/nvim-tree-lua.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,25 @@ Hijack netrw windows (overridden if |disable_netrw| is `true`)
427427
Type: `boolean`, Default: `true`
428428

429429
*nvim-tree.open_on_setup*
430+
Deprecated: please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
430431
Will automatically open the tree when running setup if startup buffer is
431432
a directory, is empty or is unnamed. nvim-tree window will be focused.
432433
Type: `boolean`, Default: `false`
433434

434435
*nvim-tree.open_on_setup_file*
436+
Deprecated: please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
435437
Will automatically open the tree when running setup if startup buffer is a file.
436438
File window will be focused.
437439
File will be found if update_focused_file is enabled.
438440
Type: `boolean`, Default: `false`
439441

440442
*nvim-tree.ignore_buffer_on_setup*
443+
Deprecated: please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
441444
Will ignore the buffer, when deciding to open the tree on setup.
442445
Type: `boolean`, Default: `false`
443446

444447
*nvim-tree.ignore_ft_on_setup*
448+
Deprecated: please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
445449
List of filetypes that will prevent `open_on_setup` to open.
446450
You can use this option if you don't want the tree to open
447451
in some scenarios (eg using vim startify).

lua/nvim-tree.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local collapse_all = require "nvim-tree.actions.tree-modifiers.collapse-all"
1313
local git = require "nvim-tree.git"
1414
local filters = require "nvim-tree.explorer.filters"
1515
local modified = require "nvim-tree.modified"
16+
local notify = require "nvim-tree.notify"
1617

1718
local _config = {}
1819

@@ -900,7 +901,17 @@ function M.setup(conf)
900901
M.setup_called = true
901902

902903
vim.schedule(function()
903-
M.on_enter(netrw_disabled)
904+
if
905+
#opts.ignore_ft_on_setup > 0
906+
or opts.open_on_setup == true
907+
or opts.open_on_setup_file
908+
or opts.ignore_buffer_on_setup
909+
then
910+
notify.info "open_on_setup behaviour has been deprecated, please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup"
911+
M.on_enter(netrw_disabled)
912+
else
913+
M.initialized = true
914+
end
904915
vim.g.NvimTreeSetup = 1
905916
vim.api.nvim_exec_autocmds("User", { pattern = "NvimTreeSetup" })
906917
end)

0 commit comments

Comments
 (0)