Vim icon indicating copy to clipboard operation
Vim copied to clipboard

`gj` and `gk` should not change `desiredColumn`

Open J-Fields opened this issue 5 years ago • 4 comments

This means going from the end of a long line to a short line, then back to a long line should remember the column you were on originally.

J-Fields avatar Dec 30 '19 16:12 J-Fields

I've been looking into this one and the #4544 (with its PR #4545) and I think I have a possible fix. The only issue it has right now is that if you move the cursor horizontally on a wrapped line (that is not the first visual line) it will still set the desiredColumn to the column value instead of using the offset.

I have a working fix for that too that is basically performing a 'cursorMove' command every time you set the desired column in order to check if we are on a wrapped line or not. The problem with that is that you can see that cursor movement. I don't think this can be fixed until vscode changes its API.

When I have the time I will push the fix I have. It's different from #4545 because it only changes the action itself (and I think it makes it more simple)

berknam avatar Jul 13 '20 16:07 berknam

+1 to this - I have j and k mapped to gj and gk for dealing with long lines, but it causes loss of the column.

mieubrisse avatar Feb 09 '21 17:02 mieubrisse

+1, I also have to remap j and k to gj and gk It work in vim. Video Example :

https://user-images.githubusercontent.com/57800056/118094016-686a7280-b3f8-11eb-83c7-b0c01a940973.mp4

barraIhsan avatar May 13 '21 07:05 barraIhsan

this issue duplicates #1323

ontanj avatar Apr 10 '24 13:04 ontanj