nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
7k stars 605 forks source link

File icons not showing #1458

Closed arhanjain closed 2 years ago

arhanjain commented 2 years ago

Hi, I'm trying to setup nvim-tree on Neovim. It's a great plugin and super useful, but for some reason I can't quite figure out why my file icons aren't showing. I'm sure it's a really silly mistake on my part, but I'd greatly appreciate any guidance on fixing this. I already have a patched font which can be seen in the LuaLine in the screenshot with the Lua file icon in the bottom right.

Here is some info: Neovim v0.7.2

in plugins.lua (using packer.nvim):

    -- Tree File Explorer
    use {
      'kyazdani42/nvim-tree.lua',
      requires = { 'kyazdani42/nvim-web-devicons' },
      config = [[require('config.nvim-tree')]],
    }

in config.nvim-tree:

local nvim_tree = require("nvim-tree")

nvim_tree.setup()

Screenshot: image

If any other info is needed, pls lmk.

alex-courtis commented 2 years ago
  1. Is nvim-web-devicons running? :lua require("nvim-web-devicons") should return with no error.
  2. Is your patched font working? :help nvim-tree-introduction shows an icon that should look like an open folder.
arhanjain commented 2 years ago

image

It looks like both aspects seem to be working. There was no error when I ran the lua command; however, I still don't see any file type icons (like lua or python files).

alex-courtis commented 2 years ago

Please attempt to replicate using the minimal config from the bug report

arhanjain commented 2 years ago

Thanks for the link to the minimal config. With inspiration with the minimal config I was able to see icons using this in my packer plugin file

  use {"kyazdani42/nvim-tree.lua", config = [[require('config.nvim-tree')]]}
  use "kyazdani42/nvim-web-devicons"

However, this isn't optimal because I have another plugin that requires the devicons package so Packer warns me that I'm importing it twice.

My version of importing nvim-tree is below. I'm failing to see what's wrong with this code since it's the same format as the installation instructions from the nvim-tree README.

    use {
      'kyazdani42/nvim-tree.lua',
      requires = { 'kyazdani42/nvim-web-devicons' },
      config = [[require('config.nvim-tree')]],
    }

Here's a link to my full plugins.lua file if it helps catch what I'm doing wrong.

alex-courtis commented 2 years ago

I won't debug your specific configuration, however I can suggest that you load nvim-web-devicons directly rather than as a dependency.

use {
      'kyazdani42/nvim-web-devicons',
      'kyazdani42/nvim-tree.lua',
kyazdani42 commented 2 years ago

I'm also not sure if packer expect config to be a lua string.

jswent commented 2 years ago

I had the same issue, and it was caused by having nvim-web-devicons run with an event. After removing it works as expected.

Before: use {'kyazdani42/nvim-web-devicons', event = 'VimEnter'}

After: use {'kyazdani42/nvim-web-devicons'}

mangelozzi commented 1 year ago

I think maybe the recommend installation instruction should be updated, since they don't work, maybe something like this:

    use {
        "nvim-tree/nvim-tree.lua",
        after = "nvim-web-devicons",
        requires = "nvim-tree/nvim-web-devicons",
    }