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

Evil Mode Support #5669

Closed
1 task done
anthonylei opened this issue Aug 7, 2022 · 9 comments
Closed
1 task done

Evil Mode Support #5669

anthonylei opened this issue Aug 7, 2022 · 9 comments
Labels
enhancement [core label] vim

Comments

@anthonylei
Copy link

Check for existing issues

  • Completed

Is your feature request related to a problem?

Having support of Vim key binding is great! But why just stop at Vim? Current Zed lacks the support of leader key as the main activation of commands. cmd+shift+p is great, but a single space key is much faster.

Describe the solution you'd like

I would love to see Zed build flexibility around key-mapping so it can support Evil mode (Vim + Emacs) in the future, such that communities can build pre-config key biddings. There are two main advantage:

  • Having space as leader are more productive (may be a bit more opinionated). All the modern Vim & Emacs derivatives support leader key. For example, Neovim, Helix, Doom, Spacemacs all use space a leader key.
  • Get the best of the both world. I can enjoy snipe/move to any text to an existing buffer while enjoying the superior key bidding of Vim.

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

No response

@anthonylei anthonylei added enhancement [core label] triage Maintainer needs to classify the issue labels Aug 7, 2022
@Kethku
Copy link
Contributor

Kethku commented Aug 8, 2022

This is planned. In particular there is discussion of how to unify keybindings in a discoverable way. One proposal is to gate Zed specific bindings behind the space bar in normal mode similar to a leader key.

Your thinking is very similar to mine. Stay tuned.

@JosephTLyons JosephTLyons added vim and removed triage Maintainer needs to classify the issue labels Aug 8, 2022
@lucastrvsn
Copy link

lucastrvsn commented Aug 9, 2022

That would be really amazing! Looking forward for that one 🙏 .

Just a suggestion, if possible: Would be great if we can navigate between editor splits using only our keyboard (even the UI elements from Zed, like file-tree). Like I do on neovim: CTRL-l goes to the right [split,window,tmux-panel], CTRL-h goes to the left [split,window,tmux-panel] and so on.

(Thank you for all the work on Neovide, really great project!)

@yury
Copy link

yury commented Mar 10, 2023

Please consider helix key bindings.

@piazzatron
Copy link

This is planned. In particular there is discussion of how to unify keybindings in a discoverable way. One proposal is to gate Zed specific bindings behind the space bar in normal mode similar to a leader key.

Your thinking is very similar to mine. Stay tuned.

Any updates on this? Loving Zed, having Evil support would let me fully move from VSCode :)

@idmyn
Copy link

idmyn commented Sep 22, 2023

This is possible now! Following tips from #5337 I added this to my keymap.json and now I can save file with space f s 🙌🏻

{
  "context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
  "bindings": {
    "space f s": "workspace::Save"
  }
}

@ConradIrwin
Copy link
Member

I'm a little unsure what this bug is actually requesting, so sorry if I'm mis-understanding! In vim_mode, you still have access to all of zed's non-conflicting editor shortcuts (which is most of them because they were designed for non-modal editing), and as @idmyn points out, you can define your own keybindings for any zed actions.

I have also recently begun to merge zed's keybindings into vim mode's (for example g n lets you get at multiple cursors; which is not strictly how vim works, but much more useful). There is documentation here: https://docs.zed.dev/general/vim

  • @yury Helix bindings would be really fun. Tracked here: Helix keymap #4642
  • @lucastrvsn key bindings for navigating between panes now exist (ctrl-w {h,j,k,l} in vim, cmd-k cmd-{left, up,down,right} in default zed). You can bind your own keyboard shortcuts to them too (see https://zed.dev/ref/default.json and search for ActivatePaneInDirection for how to do this).

Going to close this now, but please let me know (either here, or with other bug reports) if there are things that this bug was meant to encompass that I didn't understand.

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@panzacoder
Copy link

Jumping back into Zed after several months (nvim+tmux user).

One thing that has consistently stopped me from using visual IDEs is the inability to shift focus to the file-tree in the same way I can my panes. Has anyone found a solution for that? I think that's the only outstanding part of this thread not solved for.

@mrnugget
Copy link
Member

I'm looking into that, kinda. Just didn't get around to finishing up the branch. In the mean time: there's a lot of thoughts around this here too: #4270

@WarFox
Copy link

WarFox commented Apr 27, 2024

This is possible now! Following tips from #5337 I added this to my keymap.json and now I can save file with space f s 🙌🏻

{
  "context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
  "bindings": {
    "space f s": "workspace::Save"
  }
}

Thank you for sharing the snippet. This works great for my spacemacs-esque keybindings

[
  {
    "context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
    "bindings": {
      "space f s": "workspace::Save",
      "space p t": "workspace::ToggleLeftDock",
      "space p f": "file_finder::Toggle"
    }
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] vim
Projects
None yet
Development

No branches or pull requests