This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/plugins/theme/barbar.lua

39 lines
1.1 KiB
Lua
Raw Normal View History

-- See: https://github.com/romgrk/barbar.nvim
require("bufferline").setup({
auto_hide = false,
closable = false,
clickable = false,
icons = false, -- TODO: add icons (required nvim-web-devicons)
})
-------------------------------------------------------------------------------
-- Keybindings
local opts = { silent = true }
vim.keymap.set("n", "gB", "<Cmd>BufferPrevious<CR>", opts)
vim.keymap.set("n", "gb", "<Cmd>BufferNext<CR>", opts)
vim.keymap.set("n", "gQ", "<Cmd>BufferClose<CR>", opts)
-------------------------------------------------------------------------------
-- Integration with nvim-tree
local nvim_tree_events = require("nvim-tree.events")
local bufferline_state = require("bufferline.state")
local function get_tree_size()
return require("nvim-tree.view").View.width
end
nvim_tree_events.subscribe("TreeOpen", function()
bufferline_state.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe("Resize", function()
bufferline_state.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe("TreeClose", function()
bufferline_state.set_offset(0)
end)