When I edit a file in vim or nano on multiple terminal emulators it is adding a line feed to my files.
xxd of file before edit:
00001880: 5645 5574 4c53 3074 4c51 6f3d VEUtLS0tLQo=
xxd of file after an edit, save but no changes (made by me) to the file:
00001880: 5645 5574 4c53 3074 4c51 6f3d 0a VEUtLS0tLQo=.
I thought you could use :set list in vim and then remove the line feed. That does not seem to be the case. Vim is displaying a $ at the end of each line, however I am unable to see the LF and remove it. I have also tried :set binary, :set ++ffs=unix, sed -i 's/\r$//' file and other options. What am I missing here?
This is probably because of the way textfiles are defined in Unix. More specifically, a POSIX "text file" must end in a newline (or be an empty file).
To quote the POSIX definition:
That is, whenever Vim saves the file, it appends a newline.
See also: Why should text files end with a newline?
As a commenter points out, solutions are discussed here: How to stop vim from adding a newline at end of file?