updated for version 7.0c10
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
" Language: Fortran95 (and Fortran90, Fortran77, F and elf90)
|
||||
" Version: 0.36
|
||||
" URL: http://www.unb.ca/chem/ajit/indent/fortran.vim
|
||||
" Last Change: 2004 Apr. 05
|
||||
" Last Change: 2006 Apr. 02
|
||||
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www.unb.ca/chem/ajit/>
|
||||
" Usage: Do :help fortran-indent from Vim
|
||||
|
||||
@ -12,9 +12,6 @@ if exists("b:did_indent")
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
let s:cposet=&cpoptions
|
||||
set cpoptions-=C
|
||||
|
||||
setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select
|
||||
setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect
|
||||
|
||||
@ -30,11 +27,11 @@ if !exists("b:fortran_fixed_source")
|
||||
else
|
||||
" f90 and f95 allow both fixed and free source form
|
||||
" assume fixed source form unless signs of free source form
|
||||
" are detected in the first five columns of the first 25 lines
|
||||
" are detected in the first five columns of the first 250 lines
|
||||
" Detection becomes more accurate and time-consuming if more lines
|
||||
" are checked. Increase the limit below if you keep lots of comments at
|
||||
" the very top of each file and you have a fast computer
|
||||
let s:lmax = 25
|
||||
let s:lmax = 250
|
||||
if ( s:lmax > line("$") )
|
||||
let s:lmax = line("$")
|
||||
endif
|
||||
@ -64,6 +61,9 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:cposet=&cpoptions
|
||||
set cpoptions-=C
|
||||
|
||||
function FortranGetIndent(lnum)
|
||||
let ind = indent(a:lnum)
|
||||
let prevline=getline(a:lnum)
|
||||
|
||||
@ -56,7 +56,7 @@ function GetPythonIndent(lnum)
|
||||
" Trick: use the non-existing "dummy" variable to break out of the loop when
|
||||
" going too far back.
|
||||
call cursor(plnum, 1)
|
||||
let parlnum = searchpair('(', '', ')', 'nbW',
|
||||
let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
|
||||
\ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
@ -75,14 +75,14 @@ function GetPythonIndent(lnum)
|
||||
" + b
|
||||
" + c)
|
||||
call cursor(a:lnum, 1)
|
||||
let p = searchpair('(', '', ')', 'bW',
|
||||
let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
if p > 0
|
||||
if p == plnum
|
||||
" When the start is inside parenthesis, only indent one 'shiftwidth'.
|
||||
let pp = searchpair('(', '', ')', 'bW',
|
||||
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
|
||||
Reference in New Issue
Block a user