Search code examples
neovim

bufferline.nvim does not configure with packer.nvim


I want bufferline.nvim configured such that the buffers get offset when nvim-tree gets expanded. However, configuring it with the documentation didn't have any effect.

Some more testing revealed that none of the options were taking effect. See MRE below. Most noticeably, the separator style remains default.

Image: Neovim after applying MRE below.

init.lua


require("user.plugins")

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

require("nvim-tree").setup({
    view = {
        adaptive_size = true
    }
})

vim.keymap.set('n', '<c-n>', ':NvimTreeFindFileToggle<CR>')

vim.opt.termguicolors = true

require("bufferline").setup({
  options = {
    separator_style = {"AAAA", "AAAA"},
    hover = {
      enabled = true,
      delay = 200,
      reveal = {"close"}
    },
    offsets = {
      {
        filetype = "NvimTree",
        text = "File Explorer",
        highlight = "Directory",
        separator = true
      }
    }
  }
})

lua/user/plugins.lua

-- This code is exactly the same as the documentation provided at https://github.com/wbthomason/packer.nvim#bootstrapping, except with plugins specified
local ensure_packer = function()
    local fn = vim.fn
    local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
    if fn.empty(fn.glob(install_path)) > 0 then
      fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
      vim.cmd [[packadd packer.nvim]]
      return true
    end
    return false
  end
  
  local packer_bootstrap = ensure_packer()
  
  return require('packer').startup(function(use)
    use 'wbthomason/packer.nvim'
    -- My plugins here
    use 'nvim-tree/nvim-tree.lua'
    use 'nvim-tree/nvim-web-devicons'
    use 'akinsho/bufferline.nvim'
  
    -- Automatically set up your configuration after cloning packer.nvim
    -- Put this at the end after all plugins
    if packer_bootstrap then
      require('packer').sync()
    end
  end)

Solution

  • Solved: The configurations were being overridden by a different extension barbar which, despite being removed for the MRE, was cached at ~/.local/share/nvim. The configured options are taking effect after deleting the cache.