r/vim • • 1d ago

Need Help┃Solved How to get past skipped lines?

I've been getting good with vim but every now and then when I want to access a certain line, I can't move the cursor into it, it just jumps over. What I usually do it move the cursor a line above it and (number)+w a few times. Any advice for this small problem I'd be grateful.

4 Upvotes

9 comments sorted by

25

u/mar_10 1d ago

That would probably be one long line that's wrapped (for your convenience). g j Will go down into the wrapped portion.

3

u/Hot_Technology8777 1d ago

Thank you! Yeah I got a small laptop screen and use a windows manager, so I need to wrap the text so it all fits. Thanks again

3

u/purpleStabber 1d ago

You can also remap j and k to be gj and gk, I think it’s common remapping and you pretty much don’t loose anything with them

-1

u/otavioexel 22h ago

you mean "j" and "k" are useless???

1

u/Broad-Promise6954 1d ago

You can also turn off line wrapping, but that's probably a cure worse than the disease...

1

u/Biggybi Gybbigy 9h ago

Yep. Form me it's easier with this keymap:

vim.keymap.set({ 'n', 'x' }, 'k', 'v:count ? "k" : "gk"', { expr = true })
vim.keymap.set({ 'n', 'x' }, 'j', 'v:count ? "j" : "gj"', { expr = true })

Do gj/gk by default, excepct when using a count.

4

u/MuramasaSword 1d ago

Turn on line numbers.

1

u/DrHydeous Unix greybeard 21h ago

Turn on relative line numbers.

1

u/v_litvin 15h ago

Turn on booth relative and absolute numbers.