Robert's Homepage

How to Use Neovim nvim-tree.vim plugin without web-dev-icons

#development #neovim #how-to

Neovim’s plugin system has a popular kyazdani42/nvim-tree.vim plugin to render a rich file explorer in Neovim.

The kyazdani42/web-dev-icons package is an optional additional plugin that you can install to get coding style icons (e.g. folders, programming language icons, et cetera).

There is a small “gotcha” if you install the nvim-tree.vim plugin but do NOT want to use the web-dev-icons.

Specifically, you need to set ALL the named elements of the nvim_tree_icons table to be the empty string ""

vim.g.nvim_tree_icons = {
  default = "",
  symlink = "",
  git = {
    unstaged = "",
    staged = "",
  },
  folder = {
    default = "",
    arrow_open = "",
    arrow_closed = "",
    symlink_open = "",
    open = "",
    empty = "",
    empty_open = "",
    symlink = "",
  },
}

nvim-tree with empty icons

Figure 1: The nvim-tree.vim plugin with all elements set to the empty string rendering without any icons.

If you miss any entries, for example symlink_open and symlink, the “no icon” icon will render.

nvim-tree with empty icons

Figure 2: The nvim-tree.vim plugin rendering with some elements not set.

After the default state is set, you can customize the icons as needed and re-render.a