osolmaz
osolmaz

Reputation: 1923

Setting filetype for all open buffers in 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?

Upvotes: 2

Views: 2942

Answers (2)

romainl
romainl

Reputation: 196886

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

Upvotes: 7

osolmaz
osolmaz

Reputation: 1923

I now realize that I asked prematurely.

Here is how:

:bufdo execute "setfiletype fortran" 

Upvotes: 3

Related Questions