Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider alternative filetype for icons #24

Open
ColinKennedy opened this issue Apr 23, 2023 · 0 comments
Open

Consider alternative filetype for icons #24

ColinKennedy opened this issue Apr 23, 2023 · 0 comments

Comments

@ColinKennedy
Copy link

ColinKennedy commented Apr 23, 2023

Firstly I wanted to say that I love this plug-in! Often, I find that just the statusline isn't enough space to communicate all that I'd like to see and winbar.nvim has been so helpful. That said I wanted to point out a possible improvement.

I've been working with nvim-dap-ui lately and winbar.nvim looks like this, by default:

Screenshot from 2023-04-23 12-33-45

I wondered why all of the icons were the same and, it turns out, nvim-dap-ui sets each buffer's filetype rather than file extension. winbar.nvim currently only considers the file extension when trying to grab an icon from nvim-web-devicons.

I made a slight tweak to winbar.nvim's source to allow that check

local winbar_file = function()
    local file_path = vim.fn.expand('%:~:.:h')
    local filename = vim.fn.expand('%:t')
    local file_type = vim.fn.expand('%:e')  -- Note, this is actually an extension, not a file type

+   if file_type == ""
+   then
+       file_type = vim.api.nvim_buf_get_option(0, "filetype")
+   end

and now it looks like this

Screenshot from 2023-04-23 12-36-28

It's a minor thing but it'd be cool if this got upstreamed along with an explicit call to webicon's get_icon_by_filetype API function. Either way I can always use my fork. Thanks for making this plug-in!

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

No branches or pull requests

1 participant