48

I opened a file using vim on Ubuntu, and the following is displayed at the bottom of the screen:

"file.py" [noeol] 553L, 16620C

What does noeol indicate?

user664833
  • 199
  • 1
  • 5
Bon Ami
  • 883
  • 2
  • 10
  • 14

4 Answers4

47

Unix editors like vi and vim will always put newlines (\n) at the end of every line - especially including the last line. If there is no end-of-line (eol) on the last line, then it is an unusual situation and the file most certainly was not created by a standard UNIX editor.

This unusual situation is brought to your notice by the [noeol] flag in the vim editor; other editors probably have similar flags and notifications.

Mei
  • 1,136
  • 9
  • 12
23

That the last line in the file doesn't have a newline (\n)

stew
  • 971
  • 7
  • 6
  • 2
    *@Bon Ami:* Some programs, when reading your text file, need the `\n` at the end of line to consider it as a completed line (with a trailing newline char). The following example shows a file which may look like a **complete** line at a casual glance in a text editor, but `wc` does **not** condider it as a line: `printf "x">"file-no-newline"; wc -l <"file-no-newline"` -- Outpute is: `0` .. the **noeol** is just a visual aid to let you know the status.. – Peter.O Feb 16 '12 at 04:50
3

This means the OS where you viewing the file is not able to detect the line-ending of the file (if the file has any at all). Sometimes this happenes when you move file(s) across OSes(i,e.. from MS to *nix os)

In vim, if the file has windows carriage return "^M", you can fix it with the following command in vim:

:%s/^M/\r/g

meaning:

%      => select the whole buffer
s      => substitute
/^M/   => find Windows carriage return.
/\r/   => replace it with *nix carriage return

Note: in Mac OX, ^M is ctl+v && ctrl+m

thanasisp
  • 7,802
  • 2
  • 26
  • 39
z atef
  • 1,057
  • 9
  • 9
-5

Its 'NO EOL' - no end of line indicator. Very helpful if you end up opening a very large file (>1GB). Vim tries to pull all that in 1 line. This indicator helps me quickly close the file before it screws up my OS.