From a2e0db6123d7d6214fbaef39deb4d3c2789c57cf Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Sun, 2 Aug 2020 11:40:51 -0500 Subject: [PATCH] Icons: allow setting a string as file icon Closes https://github.com/kyazdani42/nvim-tree.lua/issues/45 --- lua/lib/config.lua | 2 +- lua/lib/renderer.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lib/config.lua b/lua/lib/config.lua index 0e8e262c..e7dbf12f 100644 --- a/lua/lib/config.lua +++ b/lua/lib/config.lua @@ -3,7 +3,7 @@ local M = {} function M.get_icon_state() local show_icons = vim.g.lua_tree_show_icons or { git = 1, folders = 1, files = 1 } local icons = { - default = nil, + default = "", git_icons = { unstaged = "✗", staged = "✓", diff --git a/lua/lib/renderer.lua b/lua/lib/renderer.lua index 590d6a84..3aa3e33e 100644 --- a/lua/lib/renderer.lua +++ b/lua/lib/renderer.lua @@ -29,7 +29,7 @@ if icon_state.show_folder_icon then 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 local web_devicons = require'nvim-web-devicons' @@ -158,7 +158,7 @@ local function update_draw_data(tree, depth, markers) local icon local git_icons if special[node.name] then - icon = "" + icon = icon_state.icons.default git_icons = get_git_icons(node, index, offset, 0) table.insert(hl, {'LuaTreeSpecialFile', index, offset+#git_icons, -1}) else