2012年11月12日星期一

Auto indent for fortran (.f90) in Vim

1. Download fortran.vim (v 0.3.1) and copy it to  $HOME\Vim\vimfiles\indent for Windows.

2. Revise the fortran.vim
 
   Revise the lines 19,20,57 and 61 as:


19 setlocal indentkeys+==~subroutine,=~function,=~forall,=~program,=~module

20 setlocal indentkeys+==~endsubroutine,=~endfunction,=~endforall,=~endprogram,=~endmodule

57 if line =~? '^\s*\(pure\|elemental\)\=\s*\(subroutine\|function\|program\|module\)' ||
\ line =~? '^\s*\(forall\)'

61 if getline(v:lnum) =~? '^\s*end\s*\(subroutine\|function\|forall\|program\|module\)'

   save it.

3. Create a .f90 source file and test the auto-indent for "program/function/module/subroutine", "do-loop" and "if-else".


You do not need to add any content in the _vimrc (or .vimrc) file. 




没有评论:

发表评论