Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim don't show last empty line

Tags:

linux

vim

I have written some c code, and the end of my output is '\n', when I check the output text file in vim, I cannot find the last empty line, however, when I open it with another text viewer, I can find the last empty line. How can I configure my vim to show the empty line?

like image 582
IfChan Avatar asked Sep 13 '25 12:09

IfChan


1 Answers

The way Vim shows \n / 0x0a at the end of the file is that it opens the file without complaining about [noeol] when :editing the file (in a kind of "reverse logic" from what you expect). Vim's (and Unix) philosophy is that the trailing newline should be there. This can be confusing when one is used to other editors or predominantly works on MS Windows.

There's a lot of discussion and questions about this (e.g. here); as this is unlikely to change, get used to it.

like image 96
Ingo Karkat Avatar answered Sep 16 '25 02:09

Ingo Karkat