Skip to content

Conversation

@masmu
Copy link
Contributor

@masmu masmu commented Jul 28, 2024

This PR changes the default behavior of NextTab, PreviousTab, NextSplit, PreviousSplit to not walk in circles anymore but instead splits those actions up into more atomic actions.

So e.g. NextTab just selects the next tab but doesn't switch to the first tab in case you run the action on the last tab. A new action FirstTab has been added and can be chained to restore the original behavior.

"PreviousTab"     ->       "PreviousTab|LastTab",
"NextTab"         ->       "NextTab|FirstTab",
"PreviousSplit"   ->       "PreviousSplit|LastSplit",
"NextSplit"       ->       "NextSplit|FirstSplit",

This adds a lot of flexibility to the user to create more sophisticated keybindings.

The following keybinding allows a combination of split and tab switching:

"Alt-,": "PreviousSplit|PreviousTab|LastTab",
"Alt-.": "NextSplit|NextTab|FirstTab",

@masmu
Copy link
Contributor Author

masmu commented Aug 17, 2024

I have just found another bug concerning the order of the split selection.

When adding a new BufPane it is always being inserted last into MainTab().Panes.
This leads to a confusion when using the actions PreviousSplit, NextSplit as the next/previous split may not be the expected one.

How to reproduce:

  • Launch micro and insert char "1"
  • Open a new vsplit via the command vsplit and insert "2"
  • Switch back to the left split (1) by using PreviousSplit
  • Again open a new vsplit via command: vsplit and type char "3"
  • Now switch between the 3 splits using PreviousSplit, NextSplit

Switching from most left split to the most right, the expected order would be 1, 3, 2 but actually is 1, 2, 3.

@masmu masmu force-pushed the refactor/tab-actions branch from 1af6237 to 2db2545 Compare September 15, 2024 13:13
…Split` and changed the default behavior of `NextTab`, `PreviousTab`, `NextSplit`, `PreviousSplit` to not walk in circles anymore
…t array index.

When adding a new `BufPane` it is always being inserted last into `MainTab().Panes`.
This leads to a confusion when using the actions `PreviousSplit`, `NextSplit` as the previous/next split may not be the expected one.

How to reproduce:
- Launch micro and insert char "1"
- Open a new vsplit via the command `vsplit` and insert "2"
- Switch back to the left split (1) by using `PreviousSplit`
- Again open a new vsplit via command: `vsplit` and type char "3"
- Now switch between the 3 splits using `PreviousSplit`, `NextSplit`

Switching from most left split to the most right, the expected order would be 1, 3, 2 but actually is 1, 2, 3.
@masmu masmu force-pushed the refactor/tab-actions branch from 2db2545 to 5f83661 Compare September 15, 2024 14:38
@dmaluka dmaluka requested a review from JoeKar September 15, 2024 14:46
Copy link
Collaborator

@JoeKar JoeKar left a comment

Choose a reason for hiding this comment

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

Looks OK to me too 👍, but I have to be honest that I didn't test it so far.

@dmaluka
Copy link
Collaborator

dmaluka commented Sep 16, 2024

I did. :)

@dmaluka dmaluka merged commit 9eaeb19 into zyedidia:master Sep 16, 2024
@masmu
Copy link
Contributor Author

masmu commented Sep 17, 2024

Thanks for your time and the reviews guys. 👍

@dmaluka dmaluka mentioned this pull request Dec 7, 2024
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.

3 participants