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

Expose directional focus commands #6833

Closed
1 task done
jjhiggz opened this issue Jan 27, 2024 · 0 comments · Fixed by #7141
Closed
1 task done

Expose directional focus commands #6833

jjhiggz opened this issue Jan 27, 2024 · 0 comments · Fixed by #7141
Labels
enhancement [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc workspace Feedback for workspace management, layout, interactions, etc

Comments

@jjhiggz
Copy link

jjhiggz commented Jan 27, 2024

Check for existing issues

  • Completed

Describe the feature

I really like navigating the focus around my editor by thinking about left / right / up / down. It would be awesome if there was a "FocusPanelLeft", "FocusPanelRight", "FocusPanelDown", "FocusPanelUp" commands. That way I can flip through panels much easier.

For me I would configure it like this:

  {
    "context": null,
    "bindings": {
      "ctrl-h": "panel:FocusLeft",
      "left": "panel:FocusLeft",
      "ctrl-j": "panel:FocusDown",
      "down": "panel:FocusDown",
      "ctrl-k": "panel:FocusUp",
      "up": "panel:FocusUp",
      "ctrl-l": "panel:FocusRight",
      "right": "panel:FocusRight",
    }
  }

The idea would be if I'm in the explorer on the left, and I focus to the right, I'm in the explorer, and if I focus down, I'm in the terminal.

This can kind of be done now, but it's challenging to confugure, and it's not as good because it doesn't adapt to the current windows that I have own.

Cheers Zed friends :)

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

No response

@jjhiggz jjhiggz added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Jan 27, 2024
mrnugget added a commit that referenced this issue Feb 1, 2024
This adds the ability to navigate to/from docks (Terminal, Project,
Collaboration, Assistant) via keybindings.

When using the `ActivatePaneInDirection` keybinding from the
left/bottom/right dock, we check whether the movement is towards the
center panel. If it is, we focus the last active pane.

Fixes #6833 and it came up
in a few other tickes/discussions.

Release Notes:

- Added ability to navigate to docks and back to the editor using the
`workspace::ActivatePaneInDirection` action (by default bound to `Ctrl-w
[hjkl]` in Vim mode).
([#6833](#6833)).

## Drawback

There's this weird behavior: if you start Zed and no files are opened,
you focus terminal, go left (project panel), then back to right to
terminal, the terminal isn't focused. Even though we focus it in the
code.

Maybe this is a bug in the current focus handling code?

## Demo


https://github.com/zed-industries/zed/assets/1185253/5d56db40-36aa-4758-a3bc-7a0de20ce5d7

---------

Co-authored-by: Piotr <piotr@zed.dev>
@JosephTLyons JosephTLyons added workspace Feedback for workspace management, layout, interactions, etc keymap / key binding Feedback for keyboard shortcuts, key mapping, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc workspace Feedback for workspace management, layout, interactions, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants