I need to find a method to manage long lines in Vim that span multiple display lines as separate entities for navigation purposes. To elaborate, I use Vim with the 'relative numbers' feature, which displays line numbers relative to the cursor position. This assists in jumping between lines by specifying a line number and using the j or k keys. For instance, if I'm on the 5th line and wish to jump to the 3rd, the relative numbers indicate that the 3rd line is two lines away, so I press 2k to reach it. However, the issue arises with lines that are visually extended over multiple lines due to soft wrapping, without actual line breaks (\n or \r\n). In such cases, the line numbers for the wrapped portions aren't displayed, hindering my ability to determine how many lines to navigate up or down to reach a specific point. How to display line numbers for these visually wrapped lines in Vim?

Hard wrapping isn't suitable for my case. The issue with hard wrapping is that it rigidly fixes the line length. When editing, if text is deleted from a line, the subsequent line does not automatically move up to fill the space, leaving an awkward gap. This necessitates manual line adjustments, which can disrupt the editing process

  • The j and k move the cursor by line (not display line). In your example everything should flow with vanilla Vim (vim --clean) but maybe you have mapped j to gj that move by display line. If my hypothesis is correct maybe could you adapt your question. Commented Jan 28 at 14:10
  • Welcome to Vim :-) I'm afraid the answer you would like to get does not exist :-| Vim has no feature yet to display the "display line" number and I don't know any plugin that does. However if you tell us more about the kind of edition you are doing we could propose you an alternative solution to your "problem" :-| Commented Jan 28 at 14:28

2 Answers 2


Vim is a line centric editing program.

  • Numerous Vim command takes ranges prefix that are line centric
  • The default cursor movement j, k are line oriented
  • ...
  • The Vim API is very much line centric

The standard answer to your question is to make display line and line the same using the nowrap and textwidth options:

:set nowrap
:set textwidth=80

For the problem you mention that when you delete word in a line it doesn't pull the words of the next line the standard answer is.

Make "real" new line two using two new lines and reformat your text using the gq command:

North Richmond Street, being blind, was a quiet street except at the hour when
the Christian Brothers' School set the boys free. An uninhabited house of two
storeys stood at the blind end, detached from its neighbours in a square ground.
The other houses of the street, conscious of decent lives within them, gazed at
one another with brown imperturbable faces.

The former tenant of our house, a priest, had died in the back drawing-room.
Air, musty from having been long enclosed, hung in all the rooms, and the waste
room behind the kitchen was littered with old useless papers. Among these I
found a few paper-covered books, the pages of which were curled and damp: The
Abbot, by Walter Scott, The Devout Communicant, and The Memoirs of Vidocq. I
liked the last best because its leaves were yellow. The wild garden behind the
house contained a central apple-tree and a few straggling bushes, under one of
which I found the late tenant's rusty bicycle-pump. He had been a very
charitable priest; in his will he had left all his money to institutions and the
furniture of his house to his sister.

Fundamentally Vim only displays line numbers for actual lines of text. You could use the signcolumn and some code to try to create line numbers to make 10gk work by eyeball. Frankly, though, it's probably faster to

  • eyeball the closest line, jump, and then gj/gk your way to the line you want
  • search (//?): you'd be surprised how much faster you can type a unique-enough word than a series of numbers and jump commands, especially after you practice navigating this way more often
  • hard wrap with gq: gqip is practically a habit for me, though in some circumstances using formatoptions=a is also suitable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.