Skip to content

Commit a5a17b9

Browse files
committed
perf(#3257): remove lib setup
1 parent ef3881e commit a5a17b9

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

lua/nvim-tree.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ function M.setup(config_user)
291291
require("nvim-tree.git").setup(config.g)
292292
require("nvim-tree.git.utils").setup(config.g)
293293
require("nvim-tree.view").setup(config.g)
294-
require("nvim-tree.lib").setup(config.g)
295294
require("nvim-tree.renderer.components").setup(config.g)
296295

297296
setup_autocommands()

lua/nvim-tree/lib.lua

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local view = require("nvim-tree.view")
22
local core = require("nvim-tree.core")
33
local notify = require("nvim-tree.notify")
4+
local config = require("nvim-tree.config")
45

56
---@class LibOpenOpts
67
---@field path string|nil path
@@ -25,7 +26,7 @@ end
2526
---@param cwd string
2627
local 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
3132
end
@@ -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
6162
end
@@ -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()
133134
end
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-
143136
return M

0 commit comments

Comments
 (0)