nvim-tree / nvim-web-devicons

lua `fork` of vim-web-devicons for neovim
MIT License
2.02k stars 182 forks source link

Icon for Man Pages Not Shown in Bufferline #210

Closed samEngineering closed 1 year ago

samEngineering commented 1 year ago

I like to use nvim as my manpager via the environment variable export MANPAGER="nvim +Man! -c ':set signcolumn=auto'"

and in my devicons config I have

...
   override = {
      man = {
         icon = " ",
         color = "#ffffff",
      },
...

I've tried a few different icons and colors but always get the default icon. The man filetype can be verified while viewing a man page with :echo &ft

Is it possible to override the default icon in this case? Great job on this plugin!

nvim --version
NVIM v0.8.3
alex-courtis commented 1 year ago

You can override an individual icon via API: https://github.com/nvim-tree/nvim-web-devicons#set-an-icon

samEngineering commented 1 year ago

That's what I tried first, but the result of that was no icon at all. My full config at that time was

local status, devicons = pcall(require, "nvim-web-devicons")
if not status then
   return
end

devicons.setup({
   color_icons = true,
   default = true,

   override = {
      r   = { icon="ﳒ", color=Green, name="R" },
      py  = { icon="", color=Yellow, name="Python" },
   },
})

devicons.set_icon {
   man = { icon="", color="#428850", cterm_color=65, name="Man" },
}

I also tried recalling this from my color scheme as suggested in the readme, but I still get nothing for the man icon.

alex-courtis commented 1 year ago

Is this an nvim-web-devicons issue or a bufferline issue?

Please try: :lua print(vim.inspect(require("nvim-web-devicons").get_icon("something.c")))

then try man

samEngineering commented 1 year ago

The inspect command returns the correct icon for c (""), man page still not showing any icon with the config above. Other icons work for bufferline, so I think this might be an nvim-web-devicons issue. I thought it might have been related to using the man command with the MANPAGER environment variable as described in the original post, but I get the same result if I run :Man <...> from within nvim. I hope this helps.

alex-courtis commented 1 year ago

I tried with your configuration above:

---
print("c   " .. vim.inspect(require("nvim-web-devicons").get_icon("something.c")))
print("man " .. vim.inspect(require("nvim-web-devicons").get_icon("something.man")))
print("man " .. vim.inspect(require("nvim-web-devicons").get_icon("man")))

20230228_120201

I don't know what to say; it looks to be working as intended.

The inspect command returns the correct icon for c ("")

Did it work for man?

samEngineering commented 1 year ago

Yes, those commands work with man as intended for me as well. This must be something weird happening with bufferline then. Strange that it doesn't work only for the man file type. I will continue trying to debug with the bufferline author. Thanks for your help!

alex-courtis commented 1 year ago

It might be an ordering issue between bufferline and webdevicons, or bufferline caching.