Skip to content

Commit b511816

Browse files
epheph
eph
authored and
eph
committed
chore(#2127): read the configuration correctly
1 parent 80d580d commit b511816

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ local function open_file_in_tab(filename)
190190
if M.quit_on_open then
191191
view.close()
192192
end
193-
if require('nvim-tree').config.experimental.open.relative_path then
193+
if M.relative_path then
194194
filename = utils.path_relative(filename, vim.fn.getcwd())
195195
end
196196
vim.cmd("tabe " .. vim.fn.fnameescape(filename))
@@ -200,7 +200,7 @@ local function drop(filename)
200200
if M.quit_on_open then
201201
view.close()
202202
end
203-
if require('nvim-tree').config.experimental.open.relative_path then
203+
if M.relative_path then
204204
filename = utils.path_relative(filename, vim.fn.getcwd())
205205
end
206206
vim.cmd("drop " .. vim.fn.fnameescape(filename))
@@ -210,7 +210,7 @@ local function tab_drop(filename)
210210
if M.quit_on_open then
211211
view.close()
212212
end
213-
if require('nvim-tree').config.experimental.open.relative_path then
213+
if M.relative_path then
214214
filename = utils.path_relative(filename, vim.fn.getcwd())
215215
end
216216
vim.cmd("tab :drop " .. vim.fn.fnameescape(filename))
@@ -320,7 +320,7 @@ local function open_in_new_window(filename, mode)
320320
end
321321

322322
local fname
323-
if require('nvim-tree').config.experimental.open.relative_path then
323+
if M.relative_path then
324324
fname = utils.escape_special_chars(vim.fn.fnameescape(utils.path_relative(filename, vim.fn.getcwd())))
325325
else
326326
fname = utils.escape_special_chars(vim.fn.fnameescape(filename))
@@ -360,7 +360,7 @@ end
360360

361361
local function edit_in_current_buf(filename)
362362
require("nvim-tree.view").abandon_current_window()
363-
if require('nvim-tree').config.experimental.open.relative_path then
363+
if M.relative_path then
364364
filename = utils.path_relative(filename, vim.fn.getcwd())
365365
end
366366
vim.cmd("keepalt keepjumps edit " .. vim.fn.fnameescape(filename))
@@ -419,6 +419,7 @@ end
419419
function M.setup(opts)
420420
M.quit_on_open = opts.actions.open_file.quit_on_open
421421
M.resize_window = opts.actions.open_file.resize_window
422+
M.relative_path = opts.experimental.open.relative_path
422423
if opts.actions.open_file.window_picker.chars then
423424
opts.actions.open_file.window_picker.chars = tostring(opts.actions.open_file.window_picker.chars):upper()
424425
end

0 commit comments

Comments
 (0)