nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
7.07k stars 606 forks source link

nvim-web-devicons user overrides are clobbered #2775

Open alex-courtis opened 4 months ago

alex-courtis commented 4 months ago

Description

See https://github.com/nvim-tree/nvim-web-devicons/issues/464

Neovim version

https://github.com/nvim-tree/nvim-web-devicons/issues/464

Operating system and version

Linux 6.8.9-arch1-2

Windows variant

No response

nvim-tree version

edd4e25

Clean room replication

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {}
end

local devicons = require('nvim-web-devicons')
devicons.setup({
      -- NOTE: override the icon
      override_by_extension = {
        java = { icon = "", color = "#e46368", name = "Java" },
        [".gitignore"] = { icon = "", color = "#428850", name = "GitIgnore" },
        js = { icon = "", color = "#f7cd6d", name = "JavaScript" },
        json = { icon = "", color = "#f7cd6d", name = "JSON" },
        ts = { icon = "󰛦", color = "#87b2e2", name = "TypeScript" },
        html = { icon = "", color = "#de7558", name = "Html" },
        rb = { icon = "", color = "#ef757c", name = "Rb" },
        rake = { icon = "", color = "#ef757c", name = "Rake" },
        rakefile = { icon = "", color = "#ef757c", name = "RakeFile" },
        jbuilder = { icon = "", color = "#f7cd6d", name = "Jbuilder" },
        lua = { icon = "", color = "#37c88e", name = "Lua" }
      },
      color_icons = true,
      default = false,
      strict = true,
})

Steps to reproduce

https://github.com/nvim-tree/nvim-web-devicons/issues/462

Expected behavior

Overridden icons used

Actual behavior

Default icons used

alex-courtis commented 4 months ago

A preserve option seems the best course of action.