Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set fileformat=unix for all files opend in vim?

Tags:

vim

I want change fileformat of all the files.

So I open them use vim *.

Then I want to know if there is any simple way to do this, rather than typing :set fileformat=unix and :wfor each file one by one.

like image 848
pktangyue Avatar asked Jan 06 '13 03:01

pktangyue


2 Answers

argdo is what you want, not bufdo, since you want to do it on every argument and you don't (necessarily) want to open every file first.

:argdo set ff=unix | update

should do the trick.

like image 83
dash-tom-bang Avatar answered Dec 17 '22 20:12

dash-tom-bang


Maybe you need bufdo?

 :help bufdo
 bufdo[!] {cmd}     Execute {cmd} in each buffer in the buffer list.
 It works like doing this: 
                :bfirst
                :{cmd}
                :bnext
                :{cmd}
                etc.
like image 26
Alex Kroll Avatar answered Dec 17 '22 18:12

Alex Kroll