vimrc help with line endings | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

vimrc help with line endings

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-10-2011
cokedude cokedude is offline
Registered User
 
Join Date: Feb 2010
Last Activity: 28 April 2014, 10:16 PM EDT
Posts: 396
Thanks: 26
Thanked 9 Times in 9 Posts
vimrc help with line endings

I was reading this and thought I could put this in my vimrc and it would convert the line endings to unix. Am I doing something wrong or am I missing something?


Code:
set ff=unix

Managing/Munging Line-Endings with Vi/Vim | Jeet Sukumaran

I used this command and it confirms that my global option is set to unix. I edited the file a little bit and saved it but it didn't convert it to unix. It remained in the dos format.


Code:
:verbose set ff? ffs?


Code:
fileformat=dos
  fileformats=unix,dos                                     
        Last set from ~/.vimrc

File format - Vim Tips Wiki
Sponsored Links
    #2  
Old 08-10-2011
dude2cool's Avatar
dude2cool dude2cool is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 29 April 2013, 6:57 PM EDT
Posts: 317
Thanks: 7
Thanked 60 Times in 60 Posts
Quote:
Originally Posted by COKEDUDE View Post
I was reading this and thought I could put this in my vimrc and it would convert the line endings to unix. Am I doing something wrong or am I missing something?


Code:
set ff=unix

Managing/Munging Line-Endings with Vi/Vim | Jeet Sukumaran

I used this command and it confirms that my global option is set to unix. I edited the file a little bit and saved it but it didn't convert it to unix. It remained in the dos format.


Code:
:verbose set ff? ffs?


Code:
fileformat=dos
  fileformats=unix,dos                                     
        Last set from ~/.vimrc

File format - Vim Tips Wiki
Hmm, the ::verbose set ff? ffs? Shows fileformat=dos, shouldn't it show Unix since you are setting fileformat=Unix? I think the fileformat gets set on the local buffer when you open the file. So if the file is in dos, when you open the file, it sets fileformat to dos. fileformat is a local variable. Fileformats, the other, note the plural is global and settable.
Sponsored Links
    #3  
Old 08-11-2011
pludi's Avatar
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
VIm will not automatically convert existing files. What you set in ~/.vimrc are settings for the UI and new files, but the encodings and file formats of existing files will not be changed unless the user explicitly says so.
The Following User Says Thank You to pludi For This Useful Post:
cokedude (08-11-2011)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
line endings help of non-ASCII files cokedude UNIX for Advanced & Expert Users 5 12-10-2010 01:23 AM
Vi line endings conversions cokedude UNIX for Advanced & Expert Users 1 12-08-2010 10:47 AM
Problems with Sed/awk/grep and line endings benwiggy Shell Programming and Scripting 6 06-02-2010 02:33 PM
editing crontab with vim and using .vimrc duc904 Solaris 2 12-21-2009 04:03 AM
VIMRC question ???? gk_linux Shell Programming and Scripting 6 01-19-2007 07:00 AM



All times are GMT -4. The time now is 04:24 AM.