Vim: [Feature Request] Treat lines with soft wrap the same way as non-broken lines when using j,k

Created on 30 Nov 2017  ·  6Comments  ·  Source: VSCodeVim/Vim

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


FEATURE REQUEST:

Environment:

  • VSCode Version: 1.18.1
  • VsCodeVim Version: 0.10.5
  • OS: Win10

When I work on a LaTeX document I usually turn on automatic word wrap in VS Code because of long sentences. Navigating with j,k up and down the lines is a pain then because the cursor jumps right to the next line (with line number) rather than going down one screen line.
I'd love to navigate in those lines with soft line breaks the same way as in those with hard line breaks.

Undesired behaviour can be reproduced as follows:

  1. Add lorem ipsum to document.
  2. Turn on word wrap (ALT-Z).
  3. Navigate in broken lines with j,k. Cursor will skip some screen lines and jump to next numbered line.

Desired behaviour:

Cursor should move like it does with UP,DOWN when Vim-Mode is deactivated, namely from screen line to screen line.

Most helpful comment

@elmewo I believe you're looking for gj

All 6 comments

@elmewo I believe you're looking for gj

That is correct, thank you. Unfortunately, I don't see a possibility to add conditions, such as

nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')

Can I do that here?

@elmewo unluckily, we can't do that currently.

Ok, thanks a lot! I'll close the issue, because my actual feature request is not needed. However, I'd appreciate conditional bindings in VSCodeVim.

@elmewo honestly, it seems unlikely to me that we'll be able to add conditional keybindings currently. I don't see a good way to do it that isn't fairly awkward.

However, when we integrate neovim https://github.com/Chillee/VSCodeNeovim that should be easily possible :)

It's possible to move among display lines with j, k, or by remapping key bindings as I documented in #3623.

Was this page helpful?
0 / 5 - 0 ratings