plugins/neo-tree: rename tabLabels option to reflect upstream change

This commit is contained in:
Gaetan Lepage 2023-05-12 14:13:26 +02:00 committed by Gaétan Lepage
parent 2057828096
commit cc21669583
2 changed files with 178 additions and 151 deletions

View file

@ -7,7 +7,16 @@
with lib; let with lib; let
cfg = config.plugins.neo-tree; cfg = config.plugins.neo-tree;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
basePluginPath = ["plugins" "neo-tree"];
in { in {
imports = [
(
mkRemovedOptionModule
(basePluginPath ++ ["sourceSelector" "tabLabels"])
"Use `plugins.neo-tree.sourceSelector.sources` to achieve the same functionnality."
)
];
options.plugins.neo-tree = let options.plugins.neo-tree = let
listOfRendererComponents = with types; listOf (either str attrs); listOfRendererComponents = with types; listOf (either str attrs);
@ -143,10 +152,8 @@ in {
useDefaultMappings = helpers.defaultNullOpts.mkBool true ""; useDefaultMappings = helpers.defaultNullOpts.mkBool true "";
sourceSelector = # sourceSelector provides clickable tabs to switch between sources."
helpers.mkCompositeOption sourceSelector = {
"sourceSelector provides clickable tabs to switch between sources."
{
winbar = winbar =
helpers.defaultNullOpts.mkBool false helpers.defaultNullOpts.mkBool false
"toggle to show selector on winbar"; "toggle to show selector on winbar";
@ -160,22 +167,24 @@ in {
scrolled down. scrolled down.
''; '';
tabLabels = sources =
helpers.mkCompositeOption helpers.mkNullOrOption
'' (
Configure the characters shown on each tab. with types;
Keys of the table should match the source names defined in `sources`. listOf
Value is what is printed inside the tab. (submodule {
If value is `nil` or not set, the source name is used instead. options = {
'' { source = mkOption {
filesystem = helpers.defaultNullOpts.mkStr " Files " "tab label for files"; type = str;
buffers = helpers.defaultNullOpts.mkStr " Buffers " "tab label for buffers"; description = "Name of the source to add to the bar.";
gitStatus = helpers.defaultNullOpts.mkStr " Git " "tab label for git status";
diagnostics =
helpers.defaultNullOpts.mkStr " Diagnostics "
"tab label for diagnostics";
}; };
displayName = helpers.mkNullOrOption str "How that source to appear in the bar.";
};
})
)
"Configure the characters shown on each tab.";
contentLayout = contentLayout =
helpers.defaultNullOpts.mkEnumFirstDefault ["start" "end" "focus"] helpers.defaultNullOpts.mkEnumFirstDefault ["start" "end" "focus"]
'' ''
@ -1005,15 +1014,21 @@ in {
(mkRaw cfg.sortFunction); (mkRaw cfg.sortFunction);
use_popups_for_input = cfg.usePopupsForInput; use_popups_for_input = cfg.usePopupsForInput;
use_default_mappings = cfg.useDefaultMappings; use_default_mappings = cfg.useDefaultMappings;
source_selector = with cfg.sourceSelector; source_selector = with cfg.sourceSelector; {
ifNonNull' cfg.sourceSelector {
inherit winbar statusline; inherit winbar statusline;
show_scrolled_off_parent_node = showScrolledOffParentNode; show_scrolled_off_parent_node = showScrolledOffParentNode;
tab_labels = with tabLabels; sources =
ifNonNull' cfg.sourceSelector.tabLabels { ifNonNull' cfg.sourceSelector.sources
inherit filesystem buffers diagnostics; (
git_status = gitStatus; map
}; (
source: {
inherit (source) source;
display_name = source.displayName;
}
)
cfg.sourceSelector.sources
);
content_layout = contentLayout; content_layout = contentLayout;
tabs_layout = tabsLayout; tabs_layout = tabsLayout;
truncation_character = truncationCharacter; truncation_character = truncationCharacter;

View file

@ -41,12 +41,24 @@
winbar = false; winbar = false;
statusline = false; statusline = false;
showScrolledOffParentNode = false; showScrolledOffParentNode = false;
tabLabels = { sources = [
filesystem = " Files "; {
buffers = " Buffers "; source = "filesystem";
gitStatus = " Git "; displayName = " Files ";
diagnostics = " Diagnostics "; }
}; {
source = "buffers";
displayName = " Buffers ";
}
{
source = "gitStatus";
displayName = " Git ";
}
{
source = "diagnostics";
displayName = " Diagnostics ";
}
];
contentLayout = "start"; contentLayout = "start";
tabsLayout = "equal"; tabsLayout = "equal";
truncationCharacter = ""; truncationCharacter = "";