plugin/theme: setup optional barbar plugin
This commit is contained in:
parent
a686e4b253
commit
ab06dbf6e4
3 changed files with 59 additions and 10 deletions
|
@ -11,7 +11,7 @@ let
|
||||||
plugins = callPlugins [
|
plugins = callPlugins [
|
||||||
./plugins/syntax
|
./plugins/syntax
|
||||||
./plugins/explorer
|
./plugins/explorer
|
||||||
(import ./plugins/theme { enableTabline = false; })
|
(import ./plugins/theme { enableBarBar = true; })
|
||||||
./plugins/lsp
|
./plugins/lsp
|
||||||
./plugins/formatter
|
./plugins/formatter
|
||||||
];
|
];
|
||||||
|
|
38
plugins/theme/barbar.lua
Normal file
38
plugins/theme/barbar.lua
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
-- 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)
|
|
@ -1,16 +1,27 @@
|
||||||
{ enableTabline ? false }:
|
{ enableTabline ? false
|
||||||
|
, enableBarBar ? false
|
||||||
|
}:
|
||||||
|
|
||||||
{ lib, catppuccin-nvim, lualine-nvim, lualine-lsp-progress, tabline-nvim, ... }:
|
{ lib
|
||||||
|
, catppuccin-nvim
|
||||||
|
, lualine-nvim
|
||||||
|
, lualine-lsp-progress
|
||||||
|
, tabline-nvim
|
||||||
|
, barbar-nvim
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
lualinePlugins = [ lualine-nvim lualine-lsp-progress ];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
luaConfig = (builtins.readFile ./catppuccin-nvim.lua)
|
luaConfig = (builtins.readFile ./catppuccin-nvim.lua)
|
||||||
+ (builtins.readFile ./lualine.lua)
|
+ (builtins.readFile ./lualine.lua)
|
||||||
+ (lib.optional enableTabline (builtins.readFile ./tabline.lua));
|
+ (lib.optional enableTabline (builtins.readFile ./tabline.lua))
|
||||||
|
+ (lib.optional enableBarBar (builtins.readFile ./barbar.lua));
|
||||||
|
|
||||||
plugins = [
|
plugins = [ catppuccin-nvim ]
|
||||||
catppuccin-nvim
|
++ lualinePlugins
|
||||||
|
++ (lib.optional enableTabline [ tabline-nvim ])
|
||||||
lualine-nvim
|
++ (lib.optional enableBarBar [ barbar-nvim ]);
|
||||||
lualine-lsp-progress
|
|
||||||
] ++ (lib.optional enableTabline [ tabline-nvim ]);
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue