我希望配置 bufferline.nvim,以便在 nvim-tree 扩展时缓冲区获得偏移。然而,使用文档配置它没有任何效果。
更多测试表明,所有选项均未生效。请参阅下面的 MRE。最值得注意的是,分隔符样式保持默认。
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)