zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.15k stars 2.72k forks source link

option drag to duplicate Tabs / option Click to open file in new split #14861

Open umajho opened 2 months ago

umajho commented 2 months ago

Check for existing issues

Describe the feature

Currently, one can split panes by dragging tabs (#1439). The dragged buffer will be moved to the newly split pane.

If, by holding down specific modifier keys while dragging, the buffer can be duplicated (i.e., the buffer at the drag start location is retained while the drag destination also creates a buffer that opens the file with the same scroll position as the original), it would enhance the user experience (eliminating the need to split first and then drag when there are already split panes).

Related Discussion: #14858

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

This is how it works in VSCode (holding cmd+option while dragging): 2024-07-20 17 50 19

umajho commented 2 months ago

I don't know if this is worth opening another issue, but in VSCode, holding down cmd+option not only changes the drag behavior from move to duplicate, but also alters the behavior of cmd-clicking links. When additionally holding down option, even if the link points to a file already open in the current pane, it won't jump to that file in the current pane. Instead, it will open the file in a pane to the right (the destination pane is chosen using the same method as cmd-clicking a link to a file not in the current pane, and can be a newly split pane if there are no panes on the right side) and scroll to the corresponding position. If the file is already open in the destination pane, it will switch to that file's tab and scroll to the corresponding position.

notpeter commented 1 month ago

Got it, here's the VSCode behaviors as I understand them:

  1. option dragging a tab creates a duplicate
  2. option-command clicking a symbol opens a new split with the definition/reference
  3. option clicking a filename in project panel opens a new split with that filename (even if it's already open). Called "Open to the Side" keyboard launch with ctrl-enter

These would be alternate versions of the existing Zed/VScode behavior:

  1. dragging a tab moves the tab
  2. command clicking a symbol goes to definition/references
umajho commented 1 month ago

Sorry for not making it clear. In “cmd-clicking links”, what I mean by “links” refers to symbols that appear as links when holding down the cmd key. Clicking on them will go to their definitions.

2024-07-26 12 04 37

notpeter commented 1 month ago

From #13917 @aryeh:

It would be great if this file-open feature was named so it can be mapped in vim as well.