Skip to content

feat: add Nerd Font icons to netrw using mini.icons#35

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779845803-netrw-icons
Open

feat: add Nerd Font icons to netrw using mini.icons#35
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779845803-netrw-icons

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Add a FileType netrw autocmd that prepends inline virtual text icons to each file/directory entry using mini.icons. Placed right after the existing mini.icons setup in init.lua.

How it works:

  • On FileType netrw, parses each buffer line to extract the filename
  • Strips tree view characters (│├└─) for tree listing support
  • Strips */@ suffixes (executable/symlink markers)
  • Calls mini_icons.get('directory', ...) or mini_icons.get('file', ...) to get the icon + highlight group
  • Renders icons as inline virtual text via nvim_buf_set_extmark with virt_text_pos = "inline"
  • Refreshes on TextChanged so icons update when navigating directories

Supports: thin listing (default), tree listing, and long listing styles.

Note: Currently snacks.explorer has replace_netrw = true, so netrw won't open by default. Set replace_netrw = false or remove it to use netrw with icons.

Review & Testing Checklist for Human

  • Open netrw (:Explore after setting replace_netrw = false in snacks config) and verify icons appear next to files/directories
  • Verify icons have correct highlight colors from mini.icons
  • Test navigating into subdirectories — icons should refresh
  • Confirm no errors when Nerd Font is not installed (icons will show as boxes but shouldn't error)

Notes

  • Uses pcall(require, 'mini.icons') so it degrades gracefully if mini.icons isn't loaded
  • Banner lines (starting with ") are skipped
  • The autocmd is inside the if not vim.g.vscode then block so it only runs in terminal Neovim

Link to Devin session: https://app.devin.ai/sessions/82bfd51cdde34530a147c748e72528bf
Requested by: @YeferYV

Add a FileType autocmd for netrw that prepends inline virtual text
icons to each file/directory entry using mini.icons. Handles thin,
tree, and long listing styles. Icons refresh on TextChanged.

Note: requires replace_netrw = false in snacks.explorer config
(or snacks not loaded) for netrw to be used.

Co-Authored-By: Yeff Yucra <37911404+YeferYV@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant