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

Expand split and tab actions, and try to unify naming/conventions #1446

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fidgetingbits
Copy link
Collaborator

@fidgetingbits fidgetingbits commented May 27, 2024

This expands both the tab and split commands associated actions. In trying to unify the grammar/naming, I ended up deprecating almost everything, which may be a bit controversial.

I haven't applied these new action to all of the contexts that are overriding them because I want to first agree on the naming. I also won't add a comment to the breaking changes file until we decide if/what becomes deprecated.

The background here is that we plan to neovim-talon available as a plugin, and it includes support for significantly more split and tab related functionality than what's currently available in community. Furthermore, I personally use (and I think andreas repo) have more tab-related functoinality. Most of them should be generic and part of community, especially because other apps will benefit.

I've also chosen to use the command "cross" first split navigation, because I know some people use that in vscode first splits already and @saidelike uses it for vim. I've also started using it since working on this and seems fine.

@fidgetingbits
Copy link
Collaborator Author

fidgetingbits commented May 30, 2024

As noted in #1447, there is split flip atm which changes the orientation between vertical and horizontal but I (not sure about others) generally use flip to refer to switching between the most recent "thing" I'm working with be it desktop, window, split, tab, file, folder, etc. So we may want to change that here, to split axis or split toggle or something. Looks like @saidelike uses split_layout_toggle() for this which we could use. And then maybe change split_flip() something more clear like split_focus_most_recent()

tags/splits/splits.py Outdated Show resolved Hide resolved
tags/splits/splits.py Show resolved Hide resolved
@fidgetingbits
Copy link
Collaborator Author

fidgetingbits commented Jun 6, 2024

I brought in the tab PR changes here, also significantly expanded the tab actions. For now I've only modified vscode.py to use the new actions just to demo what it would be like, but if/once we agree on naming/conventions all update all of the other apps in community.

I had noted in the tab PR that it's confusing that tabs are part of core/windows_and_tabs/ where as splits are part of tags/splits, so I also opted to move tabs to tags/tabs/ as part of this PR, as I think it's easier to find things and navigate.

@fidgetingbits fidgetingbits changed the title Expand split actions Expand split and tab actions, and try to unify naming/conventions Jun 6, 2024
@fidgetingbits
Copy link
Collaborator Author

One other thing I suspect people will want to change is atm I make the split <direction> default to an empty split, but I guess most people probably currently expect that to clone the active split, so can switch that around depending on people's preference.

@fidgetingbits fidgetingbits force-pushed the better-splits branch 3 times, most recently from 4895113 to 4b90253 Compare June 6, 2024 09:28
tags/tabs/tabs_linux.py Outdated Show resolved Hide resolved
tags/tabs/tabs_win.py Outdated Show resolved Hide resolved
tags/splits/splits.py Outdated Show resolved Hide resolved
tags/splits/splits.py Outdated Show resolved Hide resolved
apps/vscode/vscode.py Outdated Show resolved Hide resolved
apps/vscode/vscode.py Outdated Show resolved Hide resolved
actions.user.vscode("workbench.action.maximizeEditor")

def split_layout_reset():
actions.user.vscode("workbench.action.evenEditorWidths")
Copy link
Contributor

Choose a reason for hiding this comment

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

workbench.action.editorLayoutSingle

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't agree with this one. As the action description says, it's meant to resize all splits to the default, which is what workbench.action.evenEditorWidths does. What you're suggesting would be suitable for split_close_all() (and is what it does).

apps/vscode/vscode.py Outdated Show resolved Hide resolved
apps/vscode/vscode.py Outdated Show resolved Hide resolved
apps/vscode/vscode.py Outdated Show resolved Hide resolved
apps/vscode/vscode.py Outdated Show resolved Hide resolved
@saidelike
Copy link
Contributor

I made an initial review, but it looks pretty good

@fidgetingbits fidgetingbits force-pushed the better-splits branch 5 times, most recently from fb45da7 to 4cd2d5a Compare June 7, 2024 07:06
@fidgetingbits fidgetingbits marked this pull request as ready for review June 13, 2024 06:22
@fidgetingbits fidgetingbits marked this pull request as draft June 13, 2024 06:23
@fidgetingbits
Copy link
Collaborator Author

I did just add one other small split update, but I think for the most part the proposed actions/naming/etc is stable, so is good for others to look at and discuss. I'm leaving it as a draft because of still needing to update all of the other apps using tabs/splits once things are agreed upon.

This commit attempts to unify the naming of splits and tabs, as well as significantly
expanding the available functionality. The caveat is that it also deprecates most
of the previously defined actions.
tab (open | new): app.tab_open()
tab (open | new) named [<user.text>]: user.tab_open_with_name(text or "")
tab (reopen | restore): app.tab_reopen()
tab duplicate: user.tab_clone()
Copy link
Contributor

Choose a reason for hiding this comment

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

tab clone spoken from is preferred apparently, cf slack

as vscode, jetbrains, etc."""

# Renaming
def tab_rename(name: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

def tab_rename(name: str = ""):

tags/tabs/tabs.py Show resolved Hide resolved
@mod.action_class
class TabActions:
# Creation
def tab_open_with_name(name: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

def tab_open_with_name(name: str = ""):

class TabActions:
# Creation
def tab_open_with_name(name: str):
"""Opens a tab renamed to the specified"""
Copy link
Contributor

Choose a reason for hiding this comment

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

"""Opens a new tab and rename it"""


# Renaming
tab rename [<user.text>]: user.tab_rename_formatted(text or "")
tab [name] reset: user.tab_reset_name()
Copy link
Contributor

Choose a reason for hiding this comment

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

user.tab_name_reset()

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