Compare commits

..

3 commits

Author SHA1 Message Date
NotAShelf
4b4a8039e5
Merge 852c862f05 into ebe0d6c960 2024-04-27 00:32:30 +00:00
Frothy
852c862f05
lib: avoid filtering null values to be used as nil 2024-04-27 03:32:21 +03:00
3bd0243744
tabline/bufferline: convert to setupOpts
this is pretty much WIP and contains a bunch of bugs that I haven't tackled yet.
2024-04-27 03:31:37 +03:00
2 changed files with 117 additions and 14 deletions

View file

@ -77,8 +77,7 @@ in rec {
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(
_: v:
(v != null) && (toLuaObject v != "{}")
_: v: (toLuaObject v != "{}")
)
args)))
+ "}"

View file

@ -1,6 +1,6 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) enum bool either nullOr str int;
inherit (lib.types) enum bool either nullOr str int listOf;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
in {
@ -57,34 +57,40 @@ in {
};
right_mouse_command = mkOption {
type = either str luaInline;
default = lib.generators.mkLuaInline "vertical sbuffer %d";
type = nullOr (either str luaInline);
default = "vertical sbuffer %d";
description = "Command to run when right clicking a buffer";
};
middle_mouse_command = mkOption {
type = either str luaInline;
type = nullOr (either str luaInline);
default = null;
description = "Command to run when middle clicking a buffer";
};
indicator = {
icon = mkOption {
type = str;
default = "";
description = "Enable icon for indicator";
type = nullOr str;
default = null;
description = ''
The indicatotor icon to use for current buffer.
::: {.warning}
This **must** be ommitted while style is not `icon`
:::
'';
};
style = mkOption {
type = enum ["icon" "underline" "none"];
default = "icon";
default = "underline";
description = "Style for indicator";
};
};
buffer_close_icon = mkOption {
type = str;
default = "󰅖";
default = " 󰅖 ";
description = "Icon for close button";
};
@ -96,7 +102,7 @@ in {
close_icon = mkOption {
type = str;
default = "";
default = " ";
description = "Icon for close button";
};
@ -169,8 +175,8 @@ in {
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 "" )
local sym = e == "error" and " "
or (e == "warning" and " " or " " )
s = s .. n .. sym
end
return s
@ -227,6 +233,104 @@ in {
default = true;
description = "Whether or not to add filetype icon highlights";
};
show_buffer_icons = mkOption {
type = bool;
default = true;
description = "Whether or not to show buffer icons";
};
show_buffer_close_icons = mkOption {
type = bool;
default = true;
description = "Whether or not to show buffer close icons";
};
show_close_icon = mkOption {
type = bool;
default = true;
description = "Whether or not to show close icon";
};
show_tab_indicators = mkOption {
type = bool;
default = true;
description = "Whether or not to show tab indicators";
};
show_duplicate_prefix = mkOption {
type = bool;
default = true;
description = "Whether or not to show duplicate prefix";
};
duplicates_across_groups = mkOption {
type = bool;
default = true;
description = "Whether to consider duplicate paths in different groups as duplicates";
};
persist_buffer_sort = mkOption {
type = bool;
default = true;
description = "Whether or not custom sorted buffers should persist";
};
move_wraps_at_ends = mkOption {
type = bool;
default = false;
description = "Whether or not the move command \"wraps\" at the first or last position";
};
seperator_style = mkOption {
type = either (enum ["thick" "thin" "slope" "slant"]) (listOf str);
default = [" " " "];
description = ''
Style of the buffer separator.
Can be either one of the suspported values, or a list containing
**at most** two elements for `focused` and `unfocused` respectively.
'';
};
enforce_regular_tabs = mkOption {
type = bool;
default = false;
description = "Whether to enforce regular tabs";
};
always_show_bufferline = mkOption {
type = bool;
default = true;
description = "Whether to always show bufferline";
};
auto_toggle_bufferline = mkOption {
type = bool;
default = false;
description = "Whether to auto toggle bufferline";
};
hover = {
enabled = mkEnableOption "hover" // {default = true;};
delay = mkOption {
type = int;
default = 200;
description = "Delay for hover, in ms";
};
reveal = mkOption {
type = listOf str;
default = ["close"];
description = "Reveal hover window";
};
};
sort_by = mkOption {
type = either (enum ["insert_after_current" "insert_at_end" "id" "extension" "relative_directory" "directory" "tabs"]) luaInline;
default = "extension";
description = "Method to sort buffers by. Must be one of the supported valuees, or an inline Lua value.";
};
};
};
}