Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Go to a specific relative number line in Neovim

I am trying to use relative line numbers with NeoVim to jump through my file so I am expecting to digit to jump 20 lines before:

:20k 

and to jump 20 lines after:

:20j

I tried but nothing happens.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

So I tried to add this configuration to my init.v file:

nnoremap <expr> j v:count ? 'j' : 'gj'
nnoremap <expr> k v:count ? 'k' : 'gk'

But when I insert something like: :20j it gives me this error:

E471: Argument required

How can I achieve my goal?

>Solution :

You can achieve your goal by learning properly how to use your tools. I don’t know if Neovim still has it but Vim comes with $ vimtutor for the basics and you can still probably follow :help user-manual.

Case in point, it is 20j, not :20j.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading