enter image description here

I am using nvim to edit tex files. I don't know what happened. All of a sudden, tens of blank lines emerged before each line of codes. I think maybe I screwed it up by doing something wrong unconsciously. Does anyone can shed light on some ways to fix it? thanks!

  • 2
    Welcome to Vi and Vim! From the line-numbering, it appears you have 'wrap' turned on, and that there's really a large number of whitespace characters (not blank lines) at the beginning of the line. You could try == or <<..... to unindent if the indentation settings are still correct. – D. Ben Knoble Sep 21 at 12:48

My suspicion is that you have done some "repeat" command by typing a number in normal mode before applying a command, probably block-wise.

Consider this:

enter image description here

If you block-select the first column, and then insert a space (or indent) 100 times, command Ctrl-V G 100 I <space> <esc>, you have:

enter image description here

it seems you have inserted line, but it is just space.... use `:set nowrap" to remove the soft wrapping of lines, and enlarge the window:

enter image description here

Now you could use a regex, but you can also use normal blockwise: Ctrl-V, select the blank space:

enter image description here

and then d will remove it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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