LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   vim remove LF at the end (https://www.linuxquestions.org/questions/linux-software-2/vim-remove-lf-at-the-end-236635/)

michal017 09-29-2004 09:14 AM

vim remove LF at the end
 
I start up vim and type 4 characters 'asdf', no Enter at the end..
however when I save the file, it is 5 bytes long, containing 'asdf' + linefeed character..
how can I make vim not to append the LF character at the end of my file?
thanks for your help..

fiomba 10-05-2004 05:59 AM

If you hadn't already solved your problem...

After having saved with vim the file, from console:

cat file |head -c -1 >file #remove last character from file

michal017 10-05-2004 10:17 AM

thanks.. this is great..
I have not solved it with vim, but this really helps..
thanks again

CroMagnon 11-18-2004 03:14 PM

To avoid appending the extra char in vim, you need to set the binary and noeol options, i.e:
:set bin
:set noeol
then save your file. You can add these commands to your .vimrc if you will want them for every file, but I think this case would normally be the exception.

michal017 11-19-2004 12:26 AM

thanks.. this is great


All times are GMT -5. The time now is 07:25 PM.