This page contains useful configuration of vim for FORTRAN.
I summarize several useful configurations:
- style of source file (the default is fixed style):
:let fortran_free_source=1if you want to switch between free style and fixed style, add the following lines:
add them prior to the :syntax on command
nmap <S-F> :set syntax=fortran<CR>:let b:fortran_fixed_source=!b:fortran_fixed_source<CR>:set syntax=text<CR>:set syntax=fortran<CR> nmap <C-F> :filetype detect<CR>
- enable Tabs in FORTRAN (otherwise they are marked as ugly red blocks):
- code folding:
" :za toggle code folding
" :zr (zR) open all
" :zm (zM) close all
" :zc close
" :zo open
set nofoldenable " no fold by default
set foldlevel=1 " some value I don't know...
" code folding for fortran
- an enhanced vim script for FORTRAN 2003 keywords, can be found here.
- block comments
this plugin supports block comments for FORTRAN and others.
Global Plugin to comment and un-comment lines in different source files in both normal and visual mode
ctrl-c to comment a single line ctrl-x to un-comment a single line
shift-v and select multiple lines, then ctrl-c to comment the selected multiple lines
shift-v and select multiple lines, then ctrl-x to un-comment the selected multiple lines
c, c++, java, php, proc, css, html, htm, xml, xhtml, vim, vimrc, sql, sh, ksh, csh, perl, tex, fortran, ml, caml, ocaml, vhdl, haskel and normal files