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
39.34k stars 2.04k forks source link

Provide building blocks for modal editing #5212

Open miquella opened 1 year ago

miquella commented 1 year ago

Check for existing issues

Is your feature request related to a problem?

Very happy that Vim modal editing is being added as a first class feature.

However, editors like Kakoune and Helix have been attempting to make strides in modal editing in recent years. It would be a shame for Zed to be stuck with Vim style editing as the only modal editing solution.

Describe the solution you'd like

Rather than having Vim input modes and bindings hard-coded in the editor, the editor could allow custom/dynamic "modes" to be created. The Vim bindings could then be built on top of these modes.

If bindings could be built against these custom editing modes, this should open up the possibility of creating new, innovative styles of modal editing that could be used instead of Vim. This would also mean that the bindings could be built outside of the editor, so the other styles and bindings wouldn't need to be included in the editor itself.

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

No response

Daeraxa commented 1 year ago

You might like to see this discussion if you haven't already seen it https://github.com/zed-industries/feedback/discussions/369

wmstack commented 2 months ago

One thing I really want to see is Zed incorporating the selection deselection behaviour of helix. The difficulty is that Vim automatically goes to visual mode as soon as there is any selection, which makes it difficult to create helix like motion.

On the other hand, these shadow selections that are restored when you go back to normal mode, I haven't really found them useful. However the deselection-selection motions in normal mode, I really think it wouldn't be difficult to recreate in Zed.

There has to be a normal-like mode where you can make a selection like a word, line, etc. without going to visual. If I had to give it a name I would call it select mode.

Another advantage is that a vim search with / will end up picking the first letter of the match, whereas with the suggested select mode this can behave like helix by selecting the whole match without leaving select mode.