Vim show newline at the end of file

后端 未结 1 997
不知归路
不知归路 2020-12-13 17:44

Using the set eol option Vim automatically adds a newline to the end of the file when it\'s saved. I have this option on but I would like to be able to see this

相关标签:
1条回答
  • 2020-12-13 18:20

    'endofline' is on by default so you don't need it in your ~/.vimrc.

    EOL or "newline" doesn't mean "there's an empty line after here", it means "this marks the end of the line, any further characters are to be displayed on another line". "newline" != "new line".

    The last line of your file is #21 and it ends with a "newline" character. Since there's no actual line after that "newline" character, no line #22, showing a line #22 is not only wrong but misleading.

    TextMate's behavior is wrong.

    Vim's behavior is correct.

    If you want Vim to show a line #22, you'll need to explicitly add that line but it sounds rather silly to me.

    0 讨论(0)
提交回复
热议问题