1

I have nvim-tree/nvim-tree and nvim-tree/nvim-web-devicons plugins installed on my nvim lua based config. Git status icon does not appear. The status icon is usually located at the left handside of the file/folder.

Here is the snapshot that can show how It should look like if the icon appears:

enter image description here

Here is the config file of each plugin:

web-devicon.lua

require("nvim-web-devicons").setup({
    -- your personnal icons can go here (to override)
    -- you can specify color or cterm_color instead of specifying both of them
    -- DevIcon will be appended to `name`
    override = {
        fish = {
            icon = "",
            color = "#428850",
            cterm_color = "65",
            name = "fish",
        },
    },
    -- globally enable different highlight colors per icon (default to true)
    -- if set to false all icons will have the default icon's color
    color_icons = true,
    -- globally enble default icons (default to false)
    -- will get overriden by `get_icons` option
    default = true,
    -- globally enable "strict" selection of icons - icon will be looked up in
    -- different tables, first by filename, and if not found by extension; this
    -- prevents cases when file doesn't have any extension but still gets some icon
    -- because its name happened to match some extension (default to false)
    strict = true,
    -- same as `override` but specifically for overrides by filename
    -- takes effect when `strict` is true
    override_by_filename = {
        [".gitignore"] = {
            icon = "",
            color = "#f1502f",
            name = "Gitignore",
        },
    },
    -- same as `override` but specifically for overrides by extension
    -- takes effect when `strict` is true
    override_by_extension = {
        ["log"] = {
            icon = "",
            color = "#81e043",
            name = "Log",
        },
    },
})

nvim-tree.lua

-- following options are the default
-- each of these are documented in `:help nvim-tree.OPTION_NAME`

local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
    return
end

--[[ local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") ]]
--[[ if not config_status_ok then ]]
--[[    return ]]
--[[ end ]]

--[[ local tree_cb = nvim_tree_config.nvim_tree_callback ]]

nvim_tree.setup({
    filters = {
        dotfiles = false,
        git_clean = false,
        no_buffer = false,
        custom = {
            "node_modules", -- filter out node_modules directory
            ".git", -- filter out .git directory
        },
        exclude = {},
    },
    disable_netrw = true,
    hijack_netrw = true,
    --open_on_setup = false,
    open_on_tab = false,
    hijack_cursor = false,
    update_cwd = true,
    hijack_directories = {
        enable = true,
        auto_open = true,
    },
    diagnostics = {
        enable = true,
        icons = {
            hint = "",
            info = "",
            warning = "",
            error = "",
        },
    },
    update_focused_file = {
        enable = true,
        update_cwd = true,
        ignore_list = {},
    },
    git = {
        enable = true,
        ignore = true,
        timeout = 500,
    },
    view = {
        width = 30,
        --height = 30,
        hide_root_folder = false,
        side = "left",
        --auto_resize = true,
        mappings = {
            custom_only = false,
        },
        number = false,
        relativenumber = false,
    },
    actions = {
        --quit_on_open = true,
        --window_picker = { enable = true },
    },
    renderer = {
        highlight_git = true,
        root_folder_modifier = ":t",
        icons = {
            show = {
                file = true,
                folder = true,
                folder_arrow = true,
                git = true,
            },
            glyphs = {
                default = "",
                symlink = "",
                git = {
                    unstaged = "U",
                    staged = "S",
                    unmerged = "UM",
                    renamed = "R",
                    deleted = "D",
                    untracked = "",
                    ignored = "I",
                },
                folder = {
                    default = "",
                    open = "",
                    empty = "",
                    empty_open = "",
                    symlink = "",
                },
            },
        },
    },
})

I dont't know why it does not work. I have set the option renderer = {icons = {glyphs = {git = {unstaged= "U", ...}}}}. Is there something wrong with this ?

Here is the packer manager file that contains all plugins. In case it might has something to do with the way I order the plugin most particularly the "nvim-tree/nvim-web-devicons" plugin.

packer.lua

vim.cmd([[packadd packer.nvim]])

return require("packer").startup(function(use)
    --[[ rest of the plugins ]]

    use({ --- lualine
        "nvim-lualine/lualine.nvim",
        requires = { "nvim-tree/nvim-web-devicons" },
    })

    use({ -- LSPSaga
        "glepnir/lspsaga.nvim",
        opt = true,
        branch = "main",
        event = "LspAttach",
        config = function()
            require("lspsaga").setup({})
        end,
        requires = {
            { "nvim-tree/nvim-web-devicons" },
            --Please make sure you install markdown and markdown_inline parser
            { "nvim-treesitter/nvim-treesitter" },
        },
    })

    --[[ rest of the plugins ]]
end)

Or There might be a conflict between nvim-tree plugin and other plugins. But I'm not sure where the problem is. Any Idea ?

Reynald Lamury
  • 165
  • 1
  • 2
  • 9

0 Answers0