0

I have patched my own nerd-font and I want those cool icons for each file-type to be shown in the name of tab in Vim/NeoVim. I guess this can be done easily like I have customized my zsh command prompt as shown below with one line. But I don't know how to do that, and I have searched many projects/plugins on GitHub but it feels like this can be down without a plugin.

My zshrc to customize the command prompt:

PROMPT='%(?.%B%F{green}‚úî.%F{red}‚úò:%?)%b %F{208}%n%f %F{240}%3~%f %# '

which looks like:

What I want is something like this: (Picture from barbar.vim, but I think it provides too much functions than what I actually need)


My current nvim looks like this:

9
  • 1
    I think everyone should use Vim in whatever way they prefer to use Vim but just in case you're unaware, here's some good info about how Vim's tabs are not tabs in the traditional sense. (Your request for file type icons suggests you are using tabs with a one tab = one file model.) How to use tabs, "proper" usage of buffers. Read if you're so inclined...no pressure. :) Cheers. – B Layer Apr 11 at 6:04
  • 1
    @BLayer: Thanks for all links! I've watched How to use tabs and was reading reddit thread, with the SO question open in my Edge tab(the GUI-sense tab). – job_start Apr 11 at 6:45
  • 1
    :help tabline – D. Ben Knoble Apr 11 at 11:09
  • 1
  • 1
    And of course :h setting-tabline and :h setting-guitablabel. – Matt Apr 11 at 19:03
1

Finally, I decided not to re-invent the wheel, and this problem seems to be more difficult than I think. So, I give Vem-Tabline a try and it works nicely, and the default settings of this plugin are good, so no need to put code into my .vimrc. Nice!

Now my MacVim looks like this, the prefix of buffer names are now skipped by default:

2
  • That's cool. I use vim-airline and have it configured to show buffers in a similar way (I don't think it has tab display like that but I don't use them often enough to be bothered by it ;) – B Layer Apr 12 at 5:37
  • I just randomly happened upon github.com/ryanoasis/vim-devicons today and I decided to try it out. As long as I am using a Nerd Font, file type icons show up automatically in the vim-airline tabline. So if you want icons and don't mind using plugins, that's one way to do it. (And vim-airline is great.) – B Layer Apr 13 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.