refactor: extract symlink function
This commit is contained in:
parent
3084e483ae
commit
de49bf4da6
@ -137,6 +137,15 @@ local function get_special_files_map()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function build_symlink(node, padding, offset, git_hl)
|
||||||
|
local icon = get_symlink_icon()
|
||||||
|
local link_hl = git_hl or "NvimTreeSymlink"
|
||||||
|
local arrow = vim.g.nvim_tree_symlink_arrow or " ➛ "
|
||||||
|
table.insert(hl, { link_hl, index, offset, -1 })
|
||||||
|
table.insert(lines, padding .. icon .. node.name .. arrow .. node.link_to)
|
||||||
|
index = index + 1
|
||||||
|
end
|
||||||
|
|
||||||
local function update_draw_data(tree, depth, markers)
|
local function update_draw_data(tree, depth, markers)
|
||||||
local special = get_special_files_map()
|
local special = get_special_files_map()
|
||||||
|
|
||||||
@ -182,12 +191,7 @@ local function update_draw_data(tree, depth, markers)
|
|||||||
table.insert(lines, padding .. icon .. git_icon .. name .. (vim.g.nvim_tree_add_trailing == 1 and "/" or ""))
|
table.insert(lines, padding .. icon .. git_icon .. name .. (vim.g.nvim_tree_add_trailing == 1 and "/" or ""))
|
||||||
end
|
end
|
||||||
elseif node.link_to then
|
elseif node.link_to then
|
||||||
local icon = get_symlink_icon()
|
build_symlink(node, padding, offset, git_hl)
|
||||||
local link_hl = git_hl or "NvimTreeSymlink"
|
|
||||||
local arrow = vim.g.nvim_tree_symlink_arrow or " ➛ "
|
|
||||||
table.insert(hl, { link_hl, index, offset, -1 })
|
|
||||||
table.insert(lines, padding .. icon .. node.name .. arrow .. node.link_to)
|
|
||||||
index = index + 1
|
|
||||||
else
|
else
|
||||||
local icon
|
local icon
|
||||||
local git_icons
|
local git_icons
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user