[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: Writing to a file adds a newline
From:       "Antoine J. Mechelynck" <antoine.mechelynck () belgacom ! net>
Date:       2005-02-27 18:43:44
Message-ID: 422214E0.1090403 () belgacom ! net
[Download RAW message or body]

Steve Dondley wrote:
> Did a Google search and read FAQ but no luck.
> 
> I notice VIM adds a newline when saving a file.  Any way to suppress this?
> 
> 
> 
Vim only adds an end-of-line if the last line was previously unterminated.

It is intentional and was discussed this past week. Normal "text" files 
are written with an end-of-line at the end of every line including the 
last. This is IMHO the proper thing to do. Thus, for instance, when 
concatenating two files output by Vim, the last line of the first file 
won't be joined to the first line of the second file.

When editing "binary" files (with 'binary' set to TRUE), Vim checks the 
last line for the presence of an end-of-line, and sets 'eol' or 'noeol' 
accordingly. When writing a file with 'binary' on, then the 'eol' option 
governs whether or not the last line will have an end-of-line.

See
	:help 'binary'
	:help 'eol'

Best regards,
Tony.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic