Skip to content

Commit

Permalink
plugins/neo-tree: adapt to latest upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Aug 6, 2023
1 parent c66c3a6 commit 718512f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
29 changes: 18 additions & 11 deletions plugins/filetrees/neo-tree.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ in {
(basePluginPath ++ ["sourceSelector" "tabLabels"])
"Use `plugins.neo-tree.sourceSelector.sources` to achieve the same functionnality."
)
(
mkRemovedOptionModule
(basePluginPath ++ ["closeFloatsOnEscapeKey"])
"This option has been removed from upstream."
)
];
options.plugins.neo-tree = let
listOfRendererComponents = with types; listOf (either str attrs);
Expand All @@ -32,6 +37,17 @@ in {
helpers.mkCompositeOption "Window options" {
mappings = mkMappingsOption defaults;
};

mkFollowCurrentFileOption = default: {
enabled = helpers.defaultNullOpts.mkBool default ''
This will find and focus the file in the active buffer every time the current file is
changed while the tree is open.
'';

leaveDirsOpen = helpers.defaultNullOpts.mkBool false ''
`false` closes auto expanded dirs, such as with `:Neotree reveal`.
'';
};
in
helpers.extraOptionsOptions
// {
Expand Down Expand Up @@ -65,8 +81,6 @@ in {
helpers.defaultNullOpts.mkBool false
"Close Neo-tree if it is the last window left in the tab";

closeFloatsOnEscapeKey = helpers.defaultNullOpts.mkBool true "";

defaultSource = helpers.defaultNullOpts.mkStr "filesystem" "";

enableDiagnostics = helpers.defaultNullOpts.mkBool true "";
Expand Down Expand Up @@ -840,10 +854,7 @@ in {
helpers.defaultNullOpts.mkInt 50
"max number of search results when using filters";

followCurrentFile = helpers.defaultNullOpts.mkBool false ''
This will find and focus the file in the active buffer every time the current file is
changed while the tree is open.
'';
followCurrentFile = mkFollowCurrentFileOption false;

hijackNetrwBehavior =
helpers.defaultNullOpts.mkEnumFirstDefault
Expand All @@ -865,10 +876,7 @@ in {
buffers = helpers.mkCompositeOption "Buffers options" {
bindToCwd = helpers.defaultNullOpts.mkBool true "Bind to current working directory.";

followCurrentFile = helpers.defaultNullOpts.mkBool true ''
This will find and focus the file in the active buffer every time the current file is
changed while the tree is open.
'';
followCurrentFile = mkFollowCurrentFileOption true;

groupEmptyDirs =
helpers.defaultNullOpts.mkBool true
Expand Down Expand Up @@ -1032,7 +1040,6 @@ in {
add_blank_line_at_top = cfg.addBlankLineAtTop;
auto_clean_after_session_restore = cfg.autoCleanAfterSessionRestore;
close_if_last_window = cfg.closeIfLastWindow;
close_floats_on_escape_key = cfg.closeFloatsOnEscapeKey;
default_source = cfg.defaultSource;
enable_diagnostics = cfg.enableDiagnostics;
enable_git_status = cfg.enableGitStatus;
Expand Down
11 changes: 8 additions & 3 deletions tests/test-sources/plugins/filetrees/neo-tree.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
addBlankLineAtTop = false;
autoCleanAfterSessionRestore = false;
closeIfLastWindow = false;
closeFloatsOnEscapeKey = true;
defaultSource = "filesystem";
enableDiagnostics = true;
enableGitStatus = true;
Expand Down Expand Up @@ -360,13 +359,19 @@
};
groupEmptyDirs = false;
searchLimit = 50;
followCurrentFile = false;
followCurrentFile = {
enabled = false;
leaveDirsOpen = false;
};
hijackNetrwBehavior = "open_default";
useLibuvFileWatcher = false;
};
buffers = {
bindToCwd = true;
followCurrentFile = true;
followCurrentFile = {
enabled = true;
leaveDirsOpen = false;
};
groupEmptyDirs = true;
window = {
mappings = {
Expand Down

0 comments on commit 718512f

Please sign in to comment.