Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting filetype for all open buffers in Vim

Tags:

vim

I have a copious amount of files opened in vim.

How can I set filetype to, let's say, fortran for each of them, so I won't have to do the command for every file?

like image 445
osolmaz Avatar asked Dec 11 '25 15:12

osolmaz


2 Answers

If you are working with recognizable fortran files (extension *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08) Vim should be able to set their filetype by himself. Just put this line in your ~/.vimrc:

filetype plugin indent on

But, to answer your question, you should do:

:bufdo setlocal filetype=fortran
like image 57
romainl Avatar answered Dec 14 '25 05:12

romainl


I now realize that I asked prematurely.

Here is how:

:bufdo execute "setfiletype fortran" 
like image 27
osolmaz Avatar answered Dec 14 '25 03:12

osolmaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!