romgrk / barbar.nvim

The neovim tabline plugin.
2.2k stars 81 forks source link

Can't disable icons without nvim dev icons #431

Closed lucassperez closed 1 year ago

lucassperez commented 1 year ago

First of all, thanks for this very nice plugin!

With recent updates to how it is setup, though, I apparently got a bug with dev icons ):

Description

I don't have nvim dev icons installed, and on startup I'm getting a warning message saying that icons.filetype.enabled is set to true and I should set it to false, but I already am setting it to false.

To Reproduce

Here is my whole minimal config, I'm using the lazy.nvim to manage plugin installation. This is my whole init.lua right now:

local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'romgrk/barbar.nvim',
    lazy = false,
    config = function()
      require('barbar').setup({
        icons = {
          filetype = {
            enabled = false,
          },
        },
      })
    end,
  },
})

I have tried changing the config to init in the lazy plugin spec, but it keeps happening.

Might be relevant, but before recent updates, I used to run vim.cmd([[let bufferline = get(g:, 'bufferline', {'icons': v:false})]]) before running the barbar setup function (previously require('bufferline').setup(...)). Otherwise, I'd get this same warning. But now I don't really know how to get rid of it.

Is there a way to use this plugin without nvim web devicons?

Many thanks in advance and thanks for your plugin! 😊

Informations Neovim version: 0.8.3

Iron-E commented 1 year ago

@romgrk I think this is happening because of the auto-setup in plugins/barbar.lua, since filetype icons are enabled by default when that function runs.

I can think of a few workarounds, since disabling auto-setup globally would be a breaking change:

  1. add vim.g.barbar_startup to selectively disable the auto-setup,
  2. disable icons by default,
  3. set the default icons setting based on whether nvim-web-devicons is installed (performance hit for pcall).

What is your opinion?


@lucassperez for now you can keep using g:bufferline, even though it is deprecated it will still work until v2 releases.

If the deprecation notice bothers you, you can add version = '^1.0.0' to your lazy config (it will reset back to v1.5.0, and you can use your old config).

Hopefully we'll get this fixed soon :)

Iron-E commented 1 year ago

@lucassperez does #438 help?

lucassperez commented 1 year ago

@Iron-E yes, apparently it does! I found the name "barbar_setup" a little confusing at first, because I set it to true to disable the auto setup? But anyways, I switched to fix/431 branch, put it in my init part of the lazy plugin spec, and it works. And just to test it, when I set it to false, I get the same error/warning. So it definitely does help! πŸ‘πŸ‘πŸ‘

Iron-E commented 1 year ago

We can bikeshed the name πŸ˜… it was supposed to be "barbar_setup = true because I'm calling setup", but I can see how the meaning can be reversed as well.

If we come up with a better name, I'll ping you so you can change your config to match.

Edit: would barbar_auto_setup = false be better?

lucassperez commented 1 year ago

I think barbar_auto_setup = false looks more natural, although I don't really understand the code so I don't want to hint into a possible misleading name as well. In the end, with good documentation both would probably be good.