Skip to content

Commit b98ff74

Browse files
committed
tidy builder
1 parent a25bd8b commit b98ff74

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lua/nvim-tree/renderer/builder.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
local utils = require "nvim-tree.utils"
2-
local core = require "nvim-tree.core"
32
local notify = require "nvim-tree.notify"
43

54
local pad = require "nvim-tree.renderer.components.padding"
@@ -138,7 +137,7 @@ function Builder:_build_folder(node)
138137
local foldername_hl = "NvimTreeFolderName"
139138
if node.link_to and self.symlink_destination then
140139
local arrow = icons.i.symlink_arrow
141-
local link_to = utils.path_relative(node.link_to, core.get_cwd())
140+
local link_to = utils.path_relative(node.link_to, self.root_cwd)
142141
foldername = foldername .. arrow .. link_to
143142
foldername_hl = "NvimTreeSymlinkFolderName"
144143
elseif vim.tbl_contains(self.special_files, node.absolute_path) or vim.tbl_contains(self.special_files, node.name) then
@@ -160,7 +159,7 @@ function Builder:_build_symlink(node)
160159
local arrow = icons.i.symlink_arrow
161160
local symlink_formatted = node.name
162161
if self.symlink_destination then
163-
local link_to = utils.path_relative(node.link_to, core.get_cwd())
162+
local link_to = utils.path_relative(node.link_to, self.root_cwd)
164163
symlink_formatted = symlink_formatted .. arrow .. link_to
165164
end
166165

lua/nvim-tree/renderer/init.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ local DecoratorOpened = require "nvim-tree.renderer.decorator.opened"
2020
local M = {
2121
last_highlights = {},
2222
decorators = {},
23-
deco = {},
2423
}
2524

2625
local SIGN_GROUP = "NvimTreeRendererSigns"
@@ -72,7 +71,7 @@ function M.draw()
7271
local cursor = vim.api.nvim_win_get_cursor(view.get_winnr())
7372
icon_component.reset_config()
7473

75-
local lines, hl, sign_names = Builder.new(core.get_cwd(), M.deco)
74+
local lines, hl, sign_names = Builder.new(core.get_cwd(), M.decorators)
7675
:configure_root_label(M.config.root_folder_label)
7776
:configure_trailing_slash(M.config.add_trailing)
7877
:configure_special_files(M.config.special_files)
@@ -108,7 +107,7 @@ function M.setup(opts)
108107
icon_component.setup(opts)
109108

110109
-- priority order
111-
M.deco = {
110+
M.decorators = {
112111
DecoratorCut:new(opts),
113112
DecoratorCopied:new(opts),
114113
DecoratorDiagnostics:new(opts),

0 commit comments

Comments
 (0)