zed icon indicating copy to clipboard operation
zed copied to clipboard

Cannot access soft wrapped lines in Vim normal mode

Open esamattis opened this issue 1 year ago • 3 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

See the video. It is almost impossible the access soft wrapped lines in the Vim normal mode. Specifically it is impossible to wrap to cursor to the previous line when coming from the bottom of a paragraph.

As a workaround it is possible to move to the insert mode and use arrow keys.

It would be nice if the normal mode worked here like the insert mode.

Environment

Zed: v0.119.19 (Zed) OS: macOS 13.6.4 Memory: 32 GiB Architecture: x86_64

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

https://github.com/zed-industries/zed/assets/225712/81125de8-bccb-41a7-ae58-eff1fc8ee7ee

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

esamattis avatar Jan 26 '24 08:01 esamattis

@esamattis I am a passionate Vim (Nvim) user. This is expected behaviour for Vim motions. To move "visual lines" you have to use gj or gk see the help menu in Vim (:h gj or :h gk). You can remap j and k to gj and gk though if you want to have your described behaviour. I hope I could help you. Have a nice one😄.

nkxxll avatar Jan 26 '24 19:01 nkxxll

You can remap j and k to gj and gk though if you want to have your described behaviour

Ahhah, I think you're right I've just had that setup in vim for an eternity that I forgot 😅

But can you actually do that in Zed? AFAIK it is not possible to map vim keys to other keys in zed 🤔

Anyway I need to refine this issue a bit.

esamattis avatar Jan 27 '24 19:01 esamattis

Yeah, you are right it is a known issue (see here) that some keybinding can't be overwritten jet. And this is probably the also the case with j and k (I tried it, doesn't work for me either).

nkxxll avatar Jan 28 '24 13:01 nkxxll

I'm gonna close this issue because according to wording in the docs a map like feature is planned which will resolve this issue as well.

Zed does not YET have an equivalent to vim’s map command to convert one set of keystrokes into another

https://docs.zed.dev/general/vim

esamattis avatar Jan 29 '24 14:01 esamattis

This already works for me:

  {
    "context": "Editor && VimControl && !VimWaiting && !menu",
    "bindings": {
      // [...]
      "j": ["vim::Down", { "displayLines": true }],
      "k": ["vim::Up", { "displayLines": true }]
    }
  }

mrnugget avatar Feb 12 '24 09:02 mrnugget