zed icon indicating copy to clipboard operation
zed copied to clipboard

Request for default adoption of Ctrl + Tab for tab navigation

Open alexei opened this issue 1 year ago • 8 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I have found that Zed employs Ctrl + - as a keyboard shortcut for tab navigation, which diverges from the widely recognized Ctrl + Tab combination. The current choice is unconventional and unexpected, thus I would like to suggest considering the adoption of the standard Ctrl + Tab shortcut by default, for convenience and a more intuitive experience.

Environment

Zed: v0.120.6 (Zed)

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

alexei avatar Feb 03 '24 13:02 alexei

CTRL + Tab is different from CTRL + - and it's reverse counterpart CTRL + SHIFT + -

You're referring to pane switching, either in the "alt-tab"-way where you switch between last active window. The current implementation is more akin "back" and "forward" buttons of a browser, and is on-par with other implementations, at least in VSCode.

alber70g avatar Feb 06 '24 14:02 alber70g

@alber70g I'm not sure how to read your comment, but I feel I need to clarify one thing: by "tab navigation" I mean going to the next/previous tab. In a web browser that would be switching between tabs (Ctrl [+ Shift] + Tab), as opposed to navigating through history (Cmd + < and Cmd + >). I might have used the wrong terminology without realising it might lead to confusion.

As a side note, Ctrl + Tab and Ctrl + - both seem to be doing the same thing in VSCode: switching between tabs. I didn't even know about Ctrl + - until Zed...

alexei avatar Feb 06 '24 22:02 alexei

@alexei I was able to configure this by adding ↓ to my keymap.json

[
  {
    "context": "Editor",
    "bindings": {
      "ctrl-shift-tab": "pane::ActivatePrevItem",
      "ctrl-tab": "pane::ActivateNextItem"
    }
  }
]

yuk0ga avatar Feb 10 '24 23:02 yuk0ga

The keymap bindings suggested by @yuk0ga allow you to move to the tab to the right or tab to the left of the current tab. This is not what other editors do. ctrl+tab should take you back in history and ctrl+shift+tab should take you forward in history (MRU - Most Rencently Used).

Unless you only have 2 tabs open or you like to manually re-order your tabs regularly, moving between tabs to the left or right is not so useful.

garth avatar Feb 14 '24 09:02 garth

This is my main dealbreaker as well since I'm so used to it.

@alexei I was able to configure this by adding ↓ to my keymap.json

[
  {
    "context": "Editor",
    "bindings": {
      "ctrl-shift-tab": "pane::ActivatePrevItem",
      "ctrl-tab": "pane::ActivateNextItem"
    }
  }
]

This only selects the next and previous ones but not the latest active ones. I can't find the option. Do you know if it is possible to get the same behaviour as in VS Code as well?

AlessandroVol23 avatar Feb 16 '24 08:02 AlessandroVol23

I also need a way to move tabs to the left or right, something like pane::MoveToLeft and pane::MoveToRight.

martin-braun avatar Feb 23 '24 01:02 martin-braun

This is a deal braker. ctrl-tab should take me to the previous active tab I don't use ctrl-shift-tab

Not only ctrl-tab does not work and cannot be configured in cycle mode, as soon as I select file in the files panel, no keyboard shortcut works for switching tabs!

Why ruin the experience of such a fast editor ?

lishine avatar Feb 29 '24 12:02 lishine

Plus one on dealbreaker unfortunately. This is the way I'm used to navigating tabs. I actually do not want to show tabs at all, but always just use ctrl-tab for navigating by MRU. It's such muscle memory now that I cannot use an editor without it. Or maybe I'll try if I can do with:

      "ctrl-tab": "pane::ActivateLastItem",
      "alt-cmd-left": "pane::GoBack",
      "alt-cmd-right": "pane::GoForward"

for popping one item in the MRU-stack with ctrl-tab and resolve to arrow navigation if I need to go further.

Update: Nah, it really doesn't work for me without an MRU-stack. Just can't get used to it.

hedefalk avatar Mar 04 '24 09:03 hedefalk

i am currently searching for a solution for the same issue and landed here. the core problem seems to be, that zed does not even seem to have a concept of a "active tab history".

it basically is the list in the ⌘ + P file search (called file_finder in the default keymap), so we would need an action, that brings the tab of the last item (the top one) on that list to the front, if that file is currently open.

what vscode does, is opening the list, selecting the last item and bringing it to the front on release of the ctrl key. when the ctrl is not released, but tab is pressed again, it moves down the list by one item.

this also is the behaviour most people would expect, i assume. ctrl + shift + tab does the same thing, but starting from the bottom.

in conclusion, we would need a new action, that:

  • opens the file_finder on press of a key combination
  • selects the most recent item
  • selects the next item in that list, as long as the modifier key is still pressed
  • brings the corresponding tab to the foreground on release of the modifier key

and additionally an action, that does the same, but from the bottom up.

miko007 avatar Mar 20 '24 11:03 miko007

+1 its pretty annoying. What I feel users want is:

  • Cmd/Ctrl + Tab ==> Switch to last active tab. Pressing the shortcut again should bring to back to the OG tab
  • Cmd + 1/2/3/4/... ===> Switch to particular tab

This should be the default behavior IMO, especially if you want ppl to ditch Vscode

neel04 avatar Mar 24 '24 20:03 neel04

This was implemented in: https://github.com/zed-industries/zed/pull/7987, and should be available as of 0.130.0 (two weeks from now).

mikayla-maki avatar Mar 27 '24 18:03 mikayla-maki

Hi can someone pls point out how to do this with vim mode?

   "context": "Pane",
   "bindings": {
     "shift h": "pane::ActivatePrevItem",
     "shift l": "pane::ActivateNextItem"
   }
 }

The above doesn't seem to work with vim mode. Thanks

anuragg-p avatar Jul 13 '24 10:07 anuragg-p