Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding to close current node #19

Closed
levouh opened this issue Jan 8, 2022 · 7 comments
Closed

Binding to close current node #19

levouh opened this issue Jan 8, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request working-on-it

Comments

@levouh
Copy link
Contributor

levouh commented Jan 8, 2022

Say that I am in a node like this:

image

Being able to press a key and change the tree to this:

image

(so close the node that the cursor is currently inside of) would be a nice feature to have, similar to how nvim-tree.lua has close_node.

@cseickel
Copy link
Contributor

cseickel commented Jan 8, 2022

Interesting. That is easy enough to add.

@cseickel cseickel added the enhancement New feature or request label Jan 8, 2022
@cseickel cseickel self-assigned this Jan 8, 2022
@cseickel
Copy link
Contributor

cseickel commented Jan 8, 2022

@levouh Question: If a directory is currently focused, should it collapse that currently focused directory, or it's parent?

In your example, what happens when you execute close_node in the pack directory in your second screenshot?

@levouh
Copy link
Contributor Author

levouh commented Jan 8, 2022

Apologies for the delay; it would close the focused node if it was open, otherwise close the parent of the current node.

@levouh
Copy link
Contributor Author

levouh commented Jan 9, 2022

@cseickel thanks for the addition!

Messing with what you pushed on main and is works great, however I sometimes run into this issue where closing a node changes the directory of the window and goes to the wrong parent:

close_node_dir_change.mp4

Note that the starting directory (and the one that contains the file) is ~/dots, then after closing a node within ~/dots my directory (both global and tab-local) is changed to ~/

I can open a new issue for this if you'd like, poking around with the code base as well so hopefully I'll be able to contribute at some point as well.

@cseickel
Copy link
Contributor

cseickel commented Jan 9, 2022

I just opened up a bug that I think is the real cause of this issue: #22
Basically, it is not using your custom mappings, and backspace is still running the default command of navigating up. Upper case C should give you the behavior you are looking for right now.

@cseickel
Copy link
Contributor

cseickel commented Jan 9, 2022

@levouh Actually, I already figured it out! change your mapping to lower case. My default config merging is case sensitive.

<bs> instead of <BS>

I'll fix that of course, but this will get you working immediately.

@levouh
Copy link
Contributor Author

levouh commented Jan 9, 2022

Awesome, I will give it a try. Thanks for the notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request working-on-it
Projects
None yet
Development

No branches or pull requests

2 participants