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

View file

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