Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Centering cursor while jumping to line doesn't work `42 z z`

Open zzantares opened this issue 7 months ago • 0 comments

Describe the bug

In Vim when typing a line number (e.g. 42) and then z z makes it jump to that line and center the cursor vertically. I know I can use 42 g g to achieve the same effect, but my muscle memory wants to use z z for this. When pressed with no line number the z z command works great and centers the cursor vertically, it is just when a line number is given that it doesn't behave as in Vim.

I remapped z z to g g but now I can't center the cursor and instead the cursor will jump to the first line in the file (this is the way g g behaves which it makes sense), I'm not sure how expressive are the binding syntax but would appreciate if there's a way to achieve the desired effect.

To Reproduce

Open a long file, type a line number outside of the view, e.g. 100 z z, the cursor is centered within the current view but it doesn't jump to the 100th line in the file as it should.

Expected behavior

Typing 100 z z on a long file should move the cursor to the 100th line and center the cursor vertically.

Environment (please complete the following information):

  • Extension (VsCodeVim) version:
  • VSCode version:
  • OS:

Additional context Add any other context about the problem here.

zzantares avatar Apr 07 '25 04:04 zzantares