Compare commits

...

4 commits

Author SHA1 Message Date
6b27c39f5d
WIP: lualine 2024-11-27 20:28:15 -08:00
1a9b9bc43b
fix: bufferline -> bufferline.nvim 2024-11-26 21:02:57 -08:00
45c85254b2
fix: marleyos -> marleyvim 2024-11-26 21:02:57 -08:00
92b586eee3
feat: Bufferline 2024-11-26 21:02:57 -08:00
6 changed files with 159 additions and 2 deletions

View file

@ -2,7 +2,7 @@ _: {
autocmds = rec {
## [String] | String -> String -> [String] | String -> String -> String -> AttrSet
mk = event: group': pattern: callback: desc: let
group = "marleyos_${group'}";
group = "marleyvim_${group'}";
in {
inherit event group pattern callback desc;
};

10
lib/icons/default.nix Normal file
View file

@ -0,0 +1,10 @@
_: {
icons = {
diagnostics = {
error = " ";
warn = " ";
hint = " ";
info = " ";
};
};
}

View file

@ -8,7 +8,7 @@
in {
autoGroups =
mapListToAttrs (i: {
name = "marleyos_${i}";
name = "marleyvim_${i}";
value = {clear = true;};
}) [
"checktime"

View file

@ -0,0 +1,103 @@
{
lib,
helpers,
...
}: let
inherit (lib) flatten mapAttrsToList map;
inherit (lib.marleyvim) icons keys autocmds;
inherit (helpers) mkRaw;
in {
plugins.mini = {
enable = true;
modules.icons = {};
};
plugins.bufferline = {
enable = true;
settings = {
options = {
close_command.__raw = "function(n) Snacks.bufdelete(n) end";
right_mouse_command.__raw = "function(n) Snacks.bufdelete(n) end";
diagnostics = "nvim_lsp";
diagnostics_indicator.__raw =
# lua
''
function(_, _, diag)
local ret = (diag.error and "${icons.diagnostics.error}" .. diag.error .. " " or "")
.. (diag.warning and "${icons.diagnostics.warn}" .. diag.warning or "")
return vim.trim(ret)
end
'';
always_show_bufferline = true;
offsets = [
{
filetype = "neo-tree";
text = "Explorer";
highlight = "Directory";
text_align = "left";
}
];
get_element_icon.__raw = ''
function(elem)
local icon, hl, _ =
require('mini.icons').get('filetype', elem.filetype)
return icon, hl
end
'';
};
};
};
autoGroups.marleyvim_bufferline.clear = true;
autoCmd = [
(autocmds.mk' ["BufAdd" "BufDelete"] "bufferline" (
mkRaw ''
function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end
''
) "Fix bufferline when restoring a session")
];
keymaps =
[
(keys.mk ["n"] "<LEADER>bp" "<CMD>BufferLineTogglePin<CR>" "Toggle Pin")
(keys.mk ["n"] "<LEADER>bP" "<CMD>BufferLineGroupClose ungrouped<CR>"
"Delete Non-Pinned Buffers")
(keys.mk ["n"] "<LEADER>br" "<CMD>BufferLineCloseRight<CR>"
"Delete Buffers to the Right")
(keys.mk ["n"] "<LEADER>bl" "<CMD>BufferLineCloseLeft<CR>"
"Delete Buffers to the Left")
(keys.mk ["n"] "<S-H>" "<CMD>BufferLineCyclePrev<CR>" "Prev Buffer")
(keys.mk ["n"] "<S-L>" "<CMD>BufferLineCycleNext<CR>" "Next Buffer")
]
++ (flatten (mapAttrsToList (
a: ks:
map (k: keys.mk ["n"] k "<CMD>BufferLineCycle${a}<CR>" "${a} Buffer") ks
) {
Prev = ["<S-H>" "[b"];
Next = ["<S-L>" "]b"];
}))
++ (
mapAttrsToList (
a: k: let
befAft =
if (a == "Prev")
then "After"
else "Before";
in
keys.mk ["n"] "${k}B" "<CMD>BufferLineMove${a}<CR>"
"Move Buffer ${befAft} ${a}"
) {
Prev = "[";
After = "]";
}
);
}

View file

@ -0,0 +1,36 @@
_: {
plugins.lualine = {
enable = true;
luaConfig.pre.__raw = ''
vim.g.lualine_laststatus = vim.o.laststatus
if vim.fn.argc(-1) > 0 then
-- set an empty statusline till lualine loads
vim.o.statusline = " "
else
-- hide the statusline on the starter page
vim.o.laststatus = 0
end
'';
settings = {
options = {
theme = "auto";
globalstatus.__raw = "vim.o.laststatus == 3";
disabled_filetypes.statusline = [
"dashboard"
"alpha"
"ministarter"
"snacks_dashboard"
];
};
sections = {
lualine_a = ["mode"];
lualine_b = ["branch"];
lualine_c = [
];
};
};
};
}

View file

@ -0,0 +1,8 @@
_: {
plugins.mini = {
enable = true;
mockDevIcons = true;
modules.icons = {};
};
}