1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
To enable findent for vim:
find out in which directory the configuration files for vim are situated,
here we assume it is in $HOME/.vim . Enter the following commands:
##############################################
vimroot=$HOME/.vim
mkdir -p $vimroot/plugin
findent --vim_findent > $vimroot/plugin/findent.vim
mkdir -p $vimroot/after/indent
findent --vim_fortran > $vimroot/after/indent/fortran.vim
##############################################
In ~/.vimrc include the following lines:
""""""""""""""""""""""""""""""
filetype plugin indent on
syntax on
""""""""""""""""""""""""""""""
If you do not want syntax highlighting, you can switch it
off again with:
syntax off
In ~/.vimrc you can specify:
let use_findent = 1 " use findent (default)
let use_findent = 0 " do not use findent
let findent = "location-of-findent" " default: 'findent'
let use_findent_indentexpr = 1 " use findent for indentexpr
let use_findent_indentexpr = 0 " do not use findent for indentexpr
" see :help indentexpr
let findent_flags = "<flags>" " specify flags for findent, e.g.:
let findent_flags = "-i4"
default is "-i".&shiftwidth
let findent_setcolumns = 1 " for free format, width of window will
" be forced to 132 columns
let findent_setcolumns = 0 " no forcing of window width
default is 0
In findent.vim, the following mappings are defined
(assuming your LocalLeader = \):
\w toggle: to determine the indent of the line being edited:
use whole buffer (status line: wb)
or use the last usable line
\f set/change flags for findent
\c comment current line
\= indent whole buffer
Furthermore, command '==' is redefined, such that is does what
one would expect.
In findent.vim the statusline is redefined. It shows the fortran format
(free or fixed) and wb (see \w above)
In fortran.vim the format (free or fixed) of the edited file is
determined from the extension:
fixed: .f .for .fpp .ftn .fortran .f77
free: .f90 .f95 .f03 .f08
If another extension is used (and filetype is fortran, of course),
the format is deducted by findent: if in the first 4000 lines
a proof is found for free format, the format is assumed to be
free, else the format is assumed to be fixed.
|