nanozuki / tabby.nvim

A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
MIT License
607 stars 21 forks source link

incorrect file_icon on directories #153

Closed capsey closed 2 months ago

capsey commented 2 months ago

when opening a buffer on a directory (e.g. using netrw), win.file_icon() returns an icon of a file instead of an icon of a directory

image

expected behaviour:

image

possible patch:

diff --git a/lua/tabby/feature/tabwins.lua b/lua/tabby/feature/tabwins.lua
index c7e5f88..ae0ce00 100644
--- a/lua/tabby/feature/tabwins.lua
+++ b/lua/tabby/feature/tabwins.lua
@@ -125,6 +125,9 @@ function tabwins.new_win(winid, opt)
       return api.get_tab_current_win(api.get_win_tab(winid)) == winid
     end,
     file_icon = function()
+      if vim.fn.isdirectory(vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(winid))) == 1 then
+        return ''
+      end
       -- require 'kyazdani42/nvim-web-devicons'
       local name = require('tabby.module.filename').tail(winid)
       local extension = vim.fn.fnamemodify(name, ':e')
nanozuki commented 2 months ago

Looks awesome, thank you!