I use vim7 on Win32 and every time I save a file, vim adds a
new blank (CR+LF) line at the end of the file although it is
not visible when in vim. Is there an option to disable this
behaviour?

yes, there is a way to break expectations :)

The problem is that if you don't have a terminal newline in the file, you get things like (file 1.txt has no final EOL)

bash> cat 1.txt
1line 1
1line 2
1line 3bash> cat 2.txt
2line 1
2line 2
bash> cat 1.txt 2.txt
1line 1
1line 2
1line 32line 1
2line 2

when what you likely want is

bash> cat 1.txt 2.txt
1line 1
1line 2
1line 3
2line 1
2line 2


If you really must do this, you can tell vim to treat the file as binary:

        :set binary

and it won't go monkeying with the EOL. However, it's generally frowned on to create a file that doesn't cat nicely.

You can read more at

        :help 'binary'
        :help 'eol'

Hope this gives guidance in addition to answering the question...

-tim



Reply via email to