add bufferline

This commit is contained in:
Charlotte 🦝 Delenk 2022-08-10 10:41:35 +01:00
parent 070c8df044
commit a58f43a315
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,72 @@
{ pkgs, lib, ... }: {
vim.keybindings = {
keybindings = {
"[" = {
b = {
command = "<cmd>BufferLineCycleNext<CR>";
label = "Navigate to next buffer";
options.silent = true;
};
};
"]" = {
b = {
command = "<cmd>BufferLineCyclePrev<CR>";
label = "Navigate to previous buffer";
options.silent = true;
};
};
"<leader>" = {
b = {
label = "Buffer commands";
d = {
command = "<cmd>BufferLineSortByDirectory<CR>";
label = "Sort bufferline by directory";
options.silent = true;
};
e = {
command = "<cmd>BufferLineSortByExtension<CR>";
label = "Sort bufferline by extension";
options.silent = true;
};
"$" = {
command = "<cmd>BufferLineGoToBuffer -1<CR>";
label = "Go to last buffer";
options.silent = true;
};
} // (lib.attrsets.genAttrs ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"] (n: {
command = "<cmd>BufferLineGoToBuffer ${n}<CR>";
label = "Go to buffer ${n}";
options.silent = true;
}));
};
g = {
b = {
command = "<cmd>BufferLinePick<CR>";
label = "Go to buffer";
options.silent = true;
};
};
};
};
output.plugins = with pkgs.vimPlugins; [
bufferline-nvim
];
output.extra_config = ''
set termguicolors
lua << EOF
require("bufferline").setup{
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and " "
or (e == "warning" and " " or "" )
s = s .. n .. sym
end
return s
end
}
EOF
'';
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }: {
output.plugins = with pkgs.vimPlugins; [
vim-web-devicons
];
}