parent
4e24505e2b
commit
3a2f68b9d5
@ -175,7 +175,6 @@ Subsequent calls to setup will replace the previous configuration.
|
|||||||
open_on_setup = false,
|
open_on_setup = false,
|
||||||
open_on_setup_file = false,
|
open_on_setup_file = false,
|
||||||
open_on_tab = false,
|
open_on_tab = false,
|
||||||
focus_empty_on_setup = false,
|
|
||||||
ignore_buf_on_tab_change = {},
|
ignore_buf_on_tab_change = {},
|
||||||
sort_by = "name",
|
sort_by = "name",
|
||||||
root_dirs = {},
|
root_dirs = {},
|
||||||
@ -391,33 +390,28 @@ Hijack netrw windows (overridden if |disable_netrw| is `true`)
|
|||||||
Type: `boolean`, Default: `true`
|
Type: `boolean`, Default: `true`
|
||||||
|
|
||||||
*nvim-tree.open_on_setup*
|
*nvim-tree.open_on_setup*
|
||||||
Will automatically open the tree when running setup if startup buffer is a
|
Will automatically open the tree when running setup if startup buffer is
|
||||||
directory, empty or unnamed.
|
a directory, is empty or is unnamed. nvim-tree window will be focused.
|
||||||
nvim-tree window will be focused.
|
|
||||||
See |nvim-tree.focus_empty_on_setup|
|
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.open_on_setup_file*
|
*nvim-tree.open_on_setup_file*
|
||||||
Will automatically open the tree when running setup if startup buffer is a
|
Will automatically open the tree when running setup if startup buffer is a file.
|
||||||
file.
|
|
||||||
File window will be focused.
|
File window will be focused.
|
||||||
File will be found if |nvim-tree.update_focused_file| is enabled.
|
File will be found if update_focused_file is enabled.
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.ignore_buffer_on_setup*
|
*nvim-tree.ignore_buffer_on_setup*
|
||||||
Always open the tree when |nvim-tree.open_on_setup| is enabled, regardless of
|
Will ignore the buffer, when deciding to open the tree on setup.
|
||||||
the startup buffer.
|
|
||||||
Buffer window will be focused.
|
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.ignore_ft_on_setup*
|
*nvim-tree.ignore_ft_on_setup*
|
||||||
List of filetypes that will prevent |nvim-tree.open_on_setup_file|.
|
List of filetypes that will prevent `open_on_setup` to open.
|
||||||
You can use this option if you don't want the tree to open
|
You can use this option if you don't want the tree to open
|
||||||
in some scenarios (eg using vim startify).
|
in some scenarios (eg using vim startify).
|
||||||
Type: {string}, Default: `{}`
|
Type: {string}, Default: `{}`
|
||||||
|
|
||||||
*nvim-tree.ignore_buf_on_tab_change*
|
*nvim-tree.ignore_buf_on_tab_change*
|
||||||
List of filetypes or buffer names that will prevent |nvim-tree.open_on_tab|.
|
List of filetypes or buffer names that will prevent `open_on_tab` to open.
|
||||||
Type: {string}, Default: `{}`
|
Type: {string}, Default: `{}`
|
||||||
|
|
||||||
*nvim-tree.auto_reload_on_write*
|
*nvim-tree.auto_reload_on_write*
|
||||||
@ -434,11 +428,6 @@ Opens the tree automatically when switching tabpage or opening a new tabpage
|
|||||||
if the tree was previously open.
|
if the tree was previously open.
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.focus_empty_on_setup*
|
|
||||||
When the tree opens as a result of |nvim-tree.open_on_setup| or
|
|
||||||
|nvim-tree.open_on_tab| and the buffer is empty, focus the buffer.
|
|
||||||
Type: `boolean`, Default: `false`
|
|
||||||
|
|
||||||
*nvim-tree.sort_by*
|
*nvim-tree.sort_by*
|
||||||
Changes how files within the same directory are sorted.
|
Changes how files within the same directory are sorted.
|
||||||
Can be one of `name`, `case_sensitive`, `modification_time`, `extension` or a
|
Can be one of `name`, `case_sensitive`, `modification_time`, `extension` or a
|
||||||
@ -491,8 +480,7 @@ Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
|||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
*nvim-tree.hijack_directories* (previously `update_to_buf_dir`)
|
*nvim-tree.hijack_directories* (previously `update_to_buf_dir`)
|
||||||
hijacks new directory buffers when they are opened (`:e dir`) or if a
|
hijacks new directory buffers when they are opened (`:e dir`).
|
||||||
directory is opened on startup e.g. `nvim .`
|
|
||||||
|
|
||||||
*nvim-tree.hijack_directories.enable*
|
*nvim-tree.hijack_directories.enable*
|
||||||
Enable the feature.
|
Enable the feature.
|
||||||
|
|||||||
@ -135,7 +135,8 @@ end
|
|||||||
|
|
||||||
local function find_existing_windows()
|
local function find_existing_windows()
|
||||||
return vim.tbl_filter(function(win)
|
return vim.tbl_filter(function(win)
|
||||||
return utils.is_nvim_tree_buf(api.nvim_win_get_buf(win))
|
local buf = api.nvim_win_get_buf(win)
|
||||||
|
return api.nvim_buf_get_name(buf):match "NvimTree" ~= nil
|
||||||
end, api.nvim_list_wins())
|
end, api.nvim_list_wins())
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -236,22 +237,20 @@ function M.on_enter(netrw_disabled)
|
|||||||
local buf_has_content = #lines > 1 or (#lines == 1 and lines[1] ~= "")
|
local buf_has_content = #lines > 1 or (#lines == 1 and lines[1] ~= "")
|
||||||
|
|
||||||
local buf_is_dir = is_dir and netrw_disabled
|
local buf_is_dir = is_dir and netrw_disabled
|
||||||
|
local buf_is_empty = bufname == "" and not buf_has_content
|
||||||
local should_be_preserved = vim.tbl_contains(ft_ignore, buftype)
|
local should_be_preserved = vim.tbl_contains(ft_ignore, buftype)
|
||||||
|
|
||||||
local should_open = false
|
local should_open = false
|
||||||
local should_focus_other_window = false
|
local should_focus_other_window = false
|
||||||
local should_find = false
|
local should_find = false
|
||||||
if (_config.open_on_setup or _config.open_on_setup_file) and not should_be_preserved then
|
if (_config.open_on_setup or _config.open_on_setup_file) and not should_be_preserved then
|
||||||
if not buf_has_content and _config.open_on_setup then
|
if buf_is_dir or buf_is_empty then
|
||||||
should_open = true
|
|
||||||
should_focus_other_window = _config.focus_empty_on_setup
|
|
||||||
elseif buf_is_dir and _config.open_on_setup then
|
|
||||||
should_open = true
|
should_open = true
|
||||||
elseif is_file and _config.open_on_setup_file then
|
elseif is_file and _config.open_on_setup_file then
|
||||||
should_open = true
|
should_open = true
|
||||||
should_focus_other_window = true
|
should_focus_other_window = true
|
||||||
should_find = _config.update_focused_file.enable
|
should_find = _config.update_focused_file.enable
|
||||||
elseif _config.ignore_buffer_on_setup and _config.open_on_setup then
|
elseif _config.ignore_buffer_on_setup then
|
||||||
should_open = true
|
should_open = true
|
||||||
should_focus_other_window = true
|
should_focus_other_window = true
|
||||||
end
|
end
|
||||||
@ -459,7 +458,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
|||||||
open_on_setup = false,
|
open_on_setup = false,
|
||||||
open_on_setup_file = false,
|
open_on_setup_file = false,
|
||||||
open_on_tab = false,
|
open_on_tab = false,
|
||||||
focus_empty_on_setup = false,
|
|
||||||
ignore_buf_on_tab_change = {},
|
ignore_buf_on_tab_change = {},
|
||||||
sort_by = "name",
|
sort_by = "name",
|
||||||
root_dirs = {},
|
root_dirs = {},
|
||||||
@ -734,7 +732,6 @@ function M.setup(conf)
|
|||||||
_config.update_focused_file = opts.update_focused_file
|
_config.update_focused_file = opts.update_focused_file
|
||||||
_config.open_on_setup = opts.open_on_setup
|
_config.open_on_setup = opts.open_on_setup
|
||||||
_config.open_on_setup_file = opts.open_on_setup_file
|
_config.open_on_setup_file = opts.open_on_setup_file
|
||||||
_config.focus_empty_on_setup = opts.focus_empty_on_setup
|
|
||||||
_config.ignore_buffer_on_setup = opts.ignore_buffer_on_setup
|
_config.ignore_buffer_on_setup = opts.ignore_buffer_on_setup
|
||||||
_config.ignore_ft_on_setup = opts.ignore_ft_on_setup
|
_config.ignore_ft_on_setup = opts.ignore_ft_on_setup
|
||||||
_config.ignore_buf_on_tab_change = opts.ignore_buf_on_tab_change
|
_config.ignore_buf_on_tab_change = opts.ignore_buf_on_tab_change
|
||||||
|
|||||||
@ -295,6 +295,11 @@ local function removed(opts)
|
|||||||
utils.notify.warn "auto close feature has been removed, see note in the README (tips & reminder section)"
|
utils.notify.warn "auto close feature has been removed, see note in the README (tips & reminder section)"
|
||||||
opts.auto_close = nil
|
opts.auto_close = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.focus_empty_on_setup then
|
||||||
|
utils.notify.warn "focus_empty_on_setup has been removed and will be replaced by a new startup configuration. Please remove this option. See https://bit.ly/3S7BtqP and https://bit.ly/3yJch2T"
|
||||||
|
end
|
||||||
|
opts.focus_empty_on_setup = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.migrate_legacy_options(opts)
|
function M.migrate_legacy_options(opts)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user