Skip to content

feat: allow cycling on git/diagnostic/opened files navigation #2506

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

Merged
merged 6 commits into from
Nov 6, 2023

Conversation

Akmadan23
Copy link
Collaborator

It was really annoying to me not to have this capability

@Akmadan23
Copy link
Collaborator Author

Akmadan23 commented Nov 1, 2023

I don't understand why it complains about an access to uninitialized variable when I'm doing a nil check...

Edit: actually that nil check is not needed because once nex gets initialized the loop breaks. Still not sure about the reason for that warning tho.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works beautifully. Tested OK:

  • 3 navigation cases
  • root_folder_label = false

Can I please be a pain in the arse and ask for this to be optional?

  1. Existing users will complain about a change in behaviour
  2. :nowrapscan people like me can't cope with cycling...

Maybe something like:

node.navigate.git.next(opts)          *nvim-tree-api.node.navigate.git.next()*
    Navigate to the next item showing git status.

    Parameters: ~{opts} (table) optional parameters

    Options: ~{wrap} (boolean) wrap around the bottom of the tree, default false

node.navigate.git.prev(opts)          *nvim-tree-api.node.navigate.git.prev()*
    Navigate to the previous item showing git status.

    Parameters: ~{opts} (table) optional parameters

    Options: ~{wrap} (boolean) wrap around the top of the tree, default false

@alex-courtis
Copy link
Member

We probably should have done something like node.navigate.git(opts) and specify direction and wrap however probably not worth it...

@Akmadan23 many, many thanks for all the fantastic reviews recently - quality is increasing!

@Akmadan23
Copy link
Collaborator Author

Can I please be a pain in the arse and ask for this to be optional?

  1. Existing users will complain about a change in behaviour
  2. :nowrapscan people like me can't cope with cycling...

Sure, I initially considered to add an option for it. Also, I was not aware of the existence of nowrapscan, maybe instead of adding another option to nvim-tree we can use exactly that, wouldn't it be better?

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use exactly that, wouldn't it be better?

Brilliant. Intuitive and doesn't need any explanation. I would never have thought of that...

As per my mail I'll leave it for you to merge :)

@Akmadan23 Akmadan23 merged commit 0a99c4a into master Nov 6, 2023
@Akmadan23 Akmadan23 deleted the cycle-navigation branch November 6, 2023 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants