Icons: allow setting a string as file icon
Closes https://github.com/kyazdani42/nvim-tree.lua/issues/45
This commit is contained in:
parent
464ce21feb
commit
a2e0db6123
@ -3,7 +3,7 @@ local M = {}
|
|||||||
function M.get_icon_state()
|
function M.get_icon_state()
|
||||||
local show_icons = vim.g.lua_tree_show_icons or { git = 1, folders = 1, files = 1 }
|
local show_icons = vim.g.lua_tree_show_icons or { git = 1, folders = 1, files = 1 }
|
||||||
local icons = {
|
local icons = {
|
||||||
default = nil,
|
default = "",
|
||||||
git_icons = {
|
git_icons = {
|
||||||
unstaged = "✗",
|
unstaged = "✗",
|
||||||
staged = "✓",
|
staged = "✓",
|
||||||
|
|||||||
@ -29,7 +29,7 @@ if icon_state.show_folder_icon then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local get_file_icon = function() return "" end
|
local get_file_icon = function() return icon_state.icons.default end
|
||||||
if icon_state.show_file_icon then
|
if icon_state.show_file_icon then
|
||||||
local web_devicons = require'nvim-web-devicons'
|
local web_devicons = require'nvim-web-devicons'
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ local function update_draw_data(tree, depth, markers)
|
|||||||
local icon
|
local icon
|
||||||
local git_icons
|
local git_icons
|
||||||
if special[node.name] then
|
if special[node.name] then
|
||||||
icon = ""
|
icon = icon_state.icons.default
|
||||||
git_icons = get_git_icons(node, index, offset, 0)
|
git_icons = get_git_icons(node, index, offset, 0)
|
||||||
table.insert(hl, {'LuaTreeSpecialFile', index, offset+#git_icons, -1})
|
table.insert(hl, {'LuaTreeSpecialFile', index, offset+#git_icons, -1})
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user