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
45.73k stars 2.52k forks source link

Vim Mode - Fold/Unfold using `za` #6822

Open titouandk opened 7 months ago

titouandk commented 7 months ago

Check for existing issues

Describe the feature

VSCode has a nice Vim command za to fold / unfold code under cursor.

(This is not a native Vim behavior - Vim is natively more restrictive as you must have an existing fold for this to work.)

https://github.com/zed-industries/zed/assets/5413308/ed95f73c-7f77-4589-a79d-56bab93e716d

This works for all languages, as in markdown:

https://github.com/zed-industries/zed/assets/5413308/1e56ab80-f43b-4703-9e8d-3cf0a59170cc

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

No response

rauann commented 7 months ago

you can do it with keymaps:

  {
    "context": "Editor && VimControl && !VimWaiting && !menu",
    "bindings": {
      // put key-bindings here if you want them to work in normal & visual mode
      "g f": "editor::Fold",
      "g u": "editor::UnfoldLines"
    }
  },
titouandk commented 7 months ago

@rauann I might be wrong, but it seems to me that this solution has 2 problems:

soham-suki commented 2 months ago

Bump! Would love this feature.

MrDwarf7 commented 1 month ago

Also bump - Feels quite strange not being able to easily fold and unfold things. Are we able to hook the editor's folding controls (To enable the LSP to do a majority of the lifting work and defer to the indenting set there?)

TKone7 commented 1 month ago

Yes we absolutely need editor::ToggleFold!