Skip to content
FossShelf
Home / Categories / For Engineers

Nvim Web Devicons

Nerd Font icon library for Neovim plugins

Replaces —

2.73K stars
Screenshot of Nvim Web Devicons

Who it's for

File tree plugin author

A developer building or maintaining a Neovim file explorer (such as nvim-tree) calls `get_icon` with the filename and extension to retrieve the correct glyph and highlight name for each entry, offloading all icon maintenance to nvim-web-devicons.

You are not building a Neovim plugin that needs to display file icons.

Status line and tab bar customizer

A Neovim user configuring lualine or a custom status line calls `get_icon_color` to retrieve both the glyph and its hex color code, then uses both to render a colored filetype indicator in the status line.

Your status line plugin already bundles its own icon provider.

Neovim config maintainer with custom icon overrides

A user whose preferred icon for `.zshrc` or `.gitignore` differs from the default uses the `override_by_filename` or `override_by_extension` tables in `setup`, or calls `set_icon` at runtime, to replace specific entries without forking the library.

You are satisfied with the default icon set and have no per-filetype overrides.

The problem

Neovim plugins that display file trees, status lines, or tab bars each need filetype icons, but there is no built-in icon layer in Neovim. Without a shared library, every plugin must bundle its own icon table, duplicate color data, and handle light/dark theming independently. nvim-web-devicons solves this by providing a single, maintained Lua icon registry that any plugin can query, keeping icon coverage and color accuracy in one place.

How it works

Extension and filename lookup

Icons are stored in separate tables indexed by file extension (case-sensitive) and full filename (case-insensitive), so both `init.lua` and `Dockerfile` resolve to the correct glyph without ambiguity.

Light and dark color variants

Every icon ships with both a light and a dark color variant. The active variant is selected automatically from Neovim's `&background` option via the `OptionSet` event, or pinned manually with the `variant` option in `setup`.

GUI and cterm colors

Each icon entry carries a hex GUI color and a cterm color code, making the library usable in both modern graphical terminals and 256-color terminal emulators without additional configuration.

Full override and runtime API

Icons can be overridden at setup time via `override`, `override_by_filename`, `override_by_extension`, and `override_by_operating_system` tables, or changed at runtime with `set_icon` and `set_default_icon`. Filetype-based getters and setters are also available.

Strict and prefix matching modes

`strict` mode separates filename and extension lookups so a file with no extension cannot accidentally match an extension entry. `prefix` mode extends matching so files like `Dockerfile.dev` inherit the `Dockerfile` icon by checking the part before the first dot.

Categorized icon queries

The full registered icon set is queryable by category: `get_icons_by_filename`, `get_icons_by_extension`, `get_icons_by_operating_system`, `get_icons_by_desktop_environment`, and `get_icons_by_window_manager` return the relevant subset for each use case.

Features

  • Extension and filename lookup
  • Light and dark color variants
  • GUI and cterm colors
  • Full override and runtime API
  • Strict and prefix matching modes
  • Categorized icon queries

How to install

-- Neovim 0.12+ native plugin manager vim.pack.add({ { src = 'https://github.com/nvim-tree/nvim-web-devicons' } }) -- Minimal setup require('nvim-web-devicons').setup()

Recommended for this setup

Strengths

  • Widely adopted shared standard: With 2.7k stars and 241 forks, nvim-web-devicons is the de-facto icon provider for the Neovim plugin ecosystem. Major plugins such as nvim-tree, lualine, and telescope rely on it, meaning one installation covers the entire plugin stack.
  • Rolling release tracks Nerd Fonts upstream: New icons are added as they appear in Nerd Fonts, so the library stays current without manual intervention. Compatibility tags (`nerd-v3.2-compat`, `nerd-v2-compat`) let users pin to a known-good state when upgrading the font is not yet practical.
  • Zero-config automatic theming: Light and dark variants switch automatically on the `OptionSet` event for `&background`, requiring no extra user configuration. Manual override is available for setups that manage the background setting outside of Neovim.
  • Lua-native with minimal requirements: Written entirely in Lua, the library has no external runtime dependencies beyond Neovim 0.7.0 and a compatible Nerd Font. It integrates with Neovim's native `vim.pack` plugin manager from Neovim 0.12 onward.

Trade-offs

  • Requires a patched Nerd Font: The library depends on Nerd Font glyphs being present in the terminal font. Users who cannot install a patched font will see missing or unknown characters for most icons. Only unicode icons that happen to exist in a standard font will render correctly.
  • Windows and WSL rendering issues on some terminals: On Windows and WSL, terminals that rely on the system's default `conpty.dll` and `OpenConsole.exe` (such as Alacritty) may render icons incorrectly. The workaround is to place up-to-date versions of those files from another terminal emulator into the system PATH.
  • Setup order dependency: If another plugin calls nvim-web-devicons' `setup` before the user's own call, the user's overrides will be silently ignored. The workaround documented in the README is to call `setup` before any plugin that also configures nvim-web-devicons.
  • New icons require upstream Nerd Fonts contribution first: If a desired icon is not yet in Nerd Fonts, it cannot be added to nvim-web-devicons until a PR is merged into a project that feeds glyphs to Nerd Fonts (such as devicons/devicon). The README notes that this process can take months.

Tech stack

Languages
—
Frameworks
—
Databases
—
Tooling
—

FAQ

What font do I need to install?

You need a patched Nerd Font version 3.3 or later. The library is a rolling release that tracks new glyphs added to Nerd Fonts, so using an older font version may cause newly introduced icons to display as unknown characters. Compatibility tags exist for pinning to Nerd Font 3.2 (`nerd-v3.2-compat`) or Nerd Font 2.x (`nerd-v2-compat`).

How do I see all available icons and their colors?

Run `:NvimWebDeviconsHiTest` inside Neovim. This command displays every registered icon alongside its highlight group, letting you verify that your font renders each glyph correctly.

How do I add or override an icon?

Pass an `override`, `override_by_filename`, or `override_by_extension` table to `setup`, or call `set_icon` at runtime. Each entry needs an `icon` glyph, a `color` hex string, a `cterm_color` number, and a `name` string. To change the fallback icon used when no match is found, call `set_default_icon(icon, color, cterm_color)`.

My setup overrides are not being applied. What is wrong?

Another plugin is likely calling nvim-web-devicons `setup` before yours, which causes your call to be ignored. The fix is to call nvim-web-devicons `setup` before the setup of any plugin that also configures it. You can check whether setup has already run with `require('nvim-web-devicons').has_loaded()`.

Does the library work without Nerd Fonts?

The README notes that the library is not strictly limited to Nerd Font icons: unicode and other font glyphs can be used. However, the default icon set is built around Nerd Font code points, so most built-in icons will not render correctly without a patched font.

Similar tools

More in Engineers