11local view = require (" nvim-tree.view" )
22local core = require (" nvim-tree.core" )
33local notify = require (" nvim-tree.notify" )
4+ local config = require (" nvim-tree.config" )
45
56--- @class LibOpenOpts
67--- @field path string | nil path
2526--- @param cwd string
2627local function handle_buf_cwd (cwd )
2728 local explorer = core .get_explorer ()
28- if M .respect_buf_cwd and cwd ~= core .get_cwd () and explorer then
29+ if config . g .respect_buf_cwd and cwd ~= core .get_cwd () and explorer then
2930 explorer :change_dir (cwd )
3031 end
3132end
@@ -54,8 +55,8 @@ local function should_hijack_current_buf()
5455 ft = vim .api .nvim_buf_get_option (bufnr , " ft" ) --- @diagnostic disable-line : deprecated
5556 end
5657
57- local should_hijack_unnamed = M .hijack_unnamed_buffer_when_opening and bufname == " " and not bufmodified and ft == " "
58- local should_hijack_dir = bufname ~= " " and vim .fn .isdirectory (bufname ) == 1 and M .hijack_directories .enable
58+ local should_hijack_unnamed = config . g .hijack_unnamed_buffer_when_opening and bufname == " " and not bufmodified and ft == " "
59+ local should_hijack_dir = bufname ~= " " and vim .fn .isdirectory (bufname ) == 1 and config . g .hijack_directories .enable
5960
6061 return should_hijack_dir or should_hijack_unnamed
6162end
@@ -76,7 +77,7 @@ function M.prompt(prompt_input, prompt_select, items_short, items_long, kind, ca
7677 return " "
7778 end
7879
79- if M .select_prompts then
80+ if config . g .select_prompts then
8081 vim .ui .select (items_short , { prompt = prompt_select , kind = kind , format_item = format_item }, function (item_short )
8182 callback (item_short )
8283 end )
@@ -132,12 +133,4 @@ function M.open(opts)
132133 view .restore_tab_state ()
133134end
134135
135- function M .setup (opts )
136- M .hijack_unnamed_buffer_when_opening = opts .hijack_unnamed_buffer_when_opening
137- M .hijack_directories = opts .hijack_directories
138- M .respect_buf_cwd = opts .respect_buf_cwd
139- M .select_prompts = opts .select_prompts
140- M .group_empty = opts .renderer .group_empty
141- end
142-
143136return M
0 commit comments