SketchyVim icon indicating copy to clipboard operation
SketchyVim copied to clipboard

FR: Support for `gj` and `gk`

Open chrisgrieser opened this issue 1 year ago • 2 comments

Since most of the text fields where svim will be used have line wrapping, having gj and gk would be very useful for mappings like

nnoremap j gj
nnoremap k gk

right now, j and k move logical lines, which makes them a bit hard to predict in text fields where you are not sure where exactly the previous line is (i.e. is the line above wrapped or a "true" previous line?)

The workaround might be as simple as mapping gj and gk to arrow-down and arrow-up, since the arrow keys in macOS use visual instead of logical lines?

chrisgrieser avatar Sep 12 '22 10:09 chrisgrieser

Oh, thats a nice idea! Funnily enough I have already coded something like that for arrow key movement in scrollable views, i.e. the Finder file list or PDF viewers etc. for my personal movement keys and only compiled in when the appropriate flag is set (jklö -> left, down, up, right arrows): https://github.com/FelixKratz/SketchyVim/blob/75d24df2a18d320127f1d95e9bca912a03c36df9/src/ax.c#L241-L264 this could be used to do exactly what you want with a bit of fiddling.

I would accept pull-requests where this is optional (via a compile flag) and well integrated with the synchronization.

FelixKratz avatar Sep 12 '22 10:09 FelixKratz

I would accept pull-requests where this is optional (via a compile flag) and well integrated with the synchronization.

(Just in case you are asking me, I unfortunately have zero knowledge of C and wouldn't be able to do that 🙈)

chrisgrieser avatar Sep 12 '22 11:09 chrisgrieser