【发布时间】:2013-10-23 15:37:42
【问题描述】:
当文件末尾有换行符时,我如何在 vim 中看到?似乎 vim 总是显示一个,无论它是否真的存在。
例如,打开一个结尾有换行符的文件:
echo "hi" > hi
# confirm that there are 3 characters, because of the extra newline added by echo
wc -c hi
# open in binary mode to prevent vim from adding its own newline
vim -b hi
:set list
这表明:
hi$
现在相比之下,一个没有换行符的文件:
# prevent echo from adding newline
echo -n "hi" > hi
# confirm that there are only 2 characters now
wc -c hi
# open in binary mode to prevent vim from adding its own newline
vim -b hi
:set list
仍然显示:
hi$
那么如何在 vim 中查看文件末尾是否真的有换行符?
【问题讨论】: