LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-29-2004, 09:14 AM   #1
michal017
Member
 
Registered: Jan 2004
Location: EU
Distribution: Debian
Posts: 90

Rep: Reputation: 15
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..
 
Old 10-05-2004, 05:59 AM   #2
fiomba
Member
 
Registered: Sep 2004
Posts: 63

Rep: Reputation: 15
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
 
Old 10-05-2004, 10:17 AM   #3
michal017
Member
 
Registered: Jan 2004
Location: EU
Distribution: Debian
Posts: 90

Original Poster
Rep: Reputation: 15
thanks.. this is great..
I have not solved it with vim, but this really helps..
thanks again
 
Old 11-18-2004, 03:14 PM   #4
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
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.
 
Old 11-19-2004, 12:26 AM   #5
michal017
Member
 
Registered: Jan 2004
Location: EU
Distribution: Debian
Posts: 90

Original Poster
Rep: Reputation: 15
thanks.. this is great
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 09:00 AM
remove whitespace at end of file FunkyRes Programming 2 10-05-2004 12:31 AM
vim: mark end-of-line? trim blank lines? prell Linux - Software 3 09-20-2004 11:04 PM
^M and vim jrdioko Linux - Software 5 08-04-2004 11:36 PM
Vim wildcat22 Programming 3 03-02-2004 05:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration