New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vim removes last newline #488
Comments
I forgot to say that I tested it on Debian: I also tested it on Ubuntu: |
Sorry, I don't follow. Your file testVim5.txt consists only of a single linefeed. Why do you expect it to be shown as 2 different lines? |
On Unix the See also |
@LLyaudet for those PHP files, just don't use Also, to distinguish the difference, you can use the status line. My status line will show |
This has been discussed numereous times and can be found in the list archives. In short, this is not a Vim bug, but the traditional behaviour on Unix and preceeds the Windows behaviour. So closing as invalid. |
Somebody mentioned it in passing; and I agree this isn't a bug, so the issue should remain closed, however: The user has a problem. The problem can be fixed with different user settings. You need to set noeol and nofixeol (in very recent versions of Vim) if you want to remove the last linefeed character. There are complicated workarounds using the 'binary' option for earlier Vim versions without the fixeol option. |
On Fri, Nov 20, 2015 at 4:44 PM, Ben Fritz fritzophrenic@gmail.com wrote:
The workarounds are not complicated, however it must be remembered
Best regards, |
Hi, Personally, I just see a file as a string and it's weird if the empty string is displayed the same as the string "\n". Vim shows 1 line when there is none, 1 line when there is 1, etc. Other editors show 1 line when there is none, 2 lines when there is 1 because you visualize the string plus the possible places for insertion. Anyway I read the help for eol as suggested (fixeol is not already available for my version of Vim). @lilydjwg I knew about removing "?>" at the end but I must admit I find it ugly to have "". I'll ask to my development team what they think about it. Best regards, |
On Friday, November 20, 2015 at 1:35:35 PM UTC-6, Tony Mechelynck wrote:
The complicated part comes in because 'binary' will always write with Unix line endings even if the file was read with something else. See http://vim.wikia.com/wiki/Preserve_missing_end-of-line_at_end_of_text_files for a full workaround preserving not only the missing end of line but also the fileformat. The script there should work to accomplish the task at hand in older Vims that don't have the 'fixeol' option. |
On Fri, Nov 20, 2015 at 9:14 PM, Laurent Lyaudet
Actually, Vim makes a difference: if you have 'ruler' on, or if your Best regards, |
Hi,
I have found the following bug. When I open a file in Vim the last newline disappears.
Hence it is impossible to see it is there and to remove it (suppress or backspace doesn't work).
The problem occurs both with Linux '\n' and Windows '\r\n'.
I join a sample text file with a '\r\n'
testVim3.txt
Another sample text file with a '\n'
testVim5.txt
The problem is quite serious for php files
testVim.txt
since additional characters after "?>" are sent as HTML and you can get an error "Headers already sent" if you want to output something else that HTML.
I had to compare the result in Nano, Notepad++ and hexdump to realize the problem was with Vim.
Best regards,
Laurent Lyaudet
The text was updated successfully, but these errors were encountered: