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

Enable keyboard control of native tabs in MacOS #2740

Closed
locomo opened this issue Mar 20, 2019 · 11 comments
Closed

Enable keyboard control of native tabs in MacOS #2740

locomo opened this issue Mar 20, 2019 · 11 comments

Comments

@locomo
Copy link

locomo commented Mar 20, 2019

Problem description

In MacOS you can use the keyboard to cycle thru all open windows within an application. The Window menu currently provides "Show Next Tab" and "Show Previous Tab" functionality but no keyboard shortcuts (or at least I can't figure out what they are).

Preferred solution

Cmd-` toggles through the windows forward.
Cmd-Shift-` toggles through the windows in reverse.

Alternative solution

Provide a command that would allow users to create their own keyboard mappings (i.e. 'show_next_tab' and 'show_previous_tab'

for example:
{ "keys": ["super+`"], "command": "show_next_tab" }

@rchl
Copy link

rchl commented Mar 22, 2019

You have also tabs within windows (file tabs) so I don't think that the naming you've proposed would work.

As for using CMD+`, I don't think that OS will allow using that as it is used for switching between separate app windows. When windows are combined into native tabs, I don't think it applies anymore. I might be won't but I remember testing it before on some native app.

That said, I'm very interested in this issue too, as not being able to switch native tabs using keyboard kinda makes that feature useless for me.

@locomo
Copy link
Author

locomo commented Mar 23, 2019

RE: the CMD+` shortcut, if I disable native tabs, then CMD+` works as expected, it allows me to cycle thru open sublime windows .. i think that for most users who decide to enable native tabs it is natural to expect CMD+` to instead cycle thru the native tab stack because in this context the native tabs are containers for sublime windows

but to give users control over this, perhaps it could be configured via a setting

RE: tabs within windows, we already have various named commands that can be mapped to the keyboard like

{ "keys": ["ctrl+tab"], "command": "next_view_in_stack" },
and
{ "keys": ["super+shift+["], "command": "prev_view" },

i don't particularly care what the command is called .. 'show_next_tab' corresponds to how its worded in the Window menu .. but it could be called 'show_next_window' or whatever makes sense

@srbs
Copy link

srbs commented Mar 26, 2019

I like the idea of adding commands for this, but to continue being a good citizen on OS X, we shouldn't override the OS-level shortcuts of Cmd+` & Cmd+Shift+` (seen at System Preferences > Keyboard > Shortcuts > Keyboard > Move focus to next window).

@locomo
Copy link
Author

locomo commented Mar 28, 2019

this sounds good to me

@rkoval
Copy link

rkoval commented May 2, 2019

Would it be possible to also add native tab commands for selecting a specific native tab? You can currently do this with non-native/file tabs via the select_by_index command, but it would be nice to have keyboard control for this functionality in native tabs as well.

@rchl
Copy link

rchl commented Jul 3, 2019

Sorry but I have to ping this (even though I know it probably won't do much) as this being missing frustrates me every day as I have to reach to mouse every time I want to switch to different native tab.

I just need a command I could bind myself, it doesn't need to be enabled by default. On Mac, I would remap option+command+left (or right) to toggle native tabs as there is also shift+command+[ (or ]) to toggle file tabs so those can live together. But for that we would need to have two different commands to switch to the tab to the left and right.

@srbs
Copy link

srbs commented Jul 10, 2019

@rchl, you can always set up keyboard shortcuts on your Mac:

  1. go to System Preferences -> Keyboard -> Shortcuts
  2. select App Shortcuts on the left pane
  3. click the plus (+) sign underneath the right pane
  4. if wanted: select the application Sublime Text
  5. type the exact menu title (Show Previous Tab, Show Next Tab, etc)
  6. pick the shortcut
  7. click Add
    repeat 3-7 for each menu item you'd like to add support for

@rchl
Copy link

rchl commented Jul 10, 2019

@srbs pretty amazing.

One problem with it is that I can't pick the shortcut I wanted as it won't work if given shortcut is already handled by the app. I wanted to use cmd+alt+left which is defined to execute prev_view command in Sublime and I can't see a way to disable it. But it worked to map cmd+` to switch to next tab so that should suffice.

Thanks a lot.

@ian-nisbet
Copy link

@srbs pretty amazing.

One problem with it is that I can't pick the shortcut I wanted as it won't work if given shortcut is already handled by the app. I wanted to use cmd+alt+left which is defined to execute prev_view command in Sublime and I can't see a way to disable it. But it worked to map cmd+` to switch to next tab so that should suffice.

Thanks a lot.

I used ctrl+alt+cmd + left and right arrows

@rchl
Copy link

rchl commented Mar 17, 2021

This is now fixed in ST4 (not sure in which build).

The default keybindings provide:

	{ "keys": ["ctrl+alt+tab"], "command": "next_os_tab" },
	{ "keys": ["ctrl+alt+shift+tab"], "command": "prev_os_tab" },

and I've been running with those overridden to cmd+alt+left/right for a while now.

    { "keys": ["super+alt+left"], "command": "prev_os_tab" },
    { "keys": ["super+alt+right"], "command": "next_os_tab" },

@BenjaminSchaaf
Copy link
Member

Fixed in Sublime Text 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants