Mercurial > vim
comparison runtime/indent/fortran.vim @ 840:2c885fab04e3 v7.0e06
updated for version 7.0e06
author | vimboss |
---|---|
date | Sat, 22 Apr 2006 22:33:57 +0000 |
parents | 23f82b5d2814 |
children | 96cd8222a819 |
comparison
equal
deleted
inserted
replaced
839:1f3b1021f002 | 840:2c885fab04e3 |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: Fortran95 (and Fortran90, Fortran77, F and elf90) | 2 " Language: Fortran95 (and Fortran90, Fortran77, F and elf90) |
3 " Version: 0.36 | 3 " Version: 0.37 |
4 " URL: http://www.unb.ca/chem/ajit/indent/fortran.vim | 4 " URL: http://www.unb.ca/chem/ajit/indent/fortran.vim |
5 " Last Change: 2006 Apr. 02 | 5 " Last Change: 2006 Apr. 22 |
6 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www.unb.ca/chem/ajit/> | 6 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www.unb.ca/chem/ajit/> |
7 " Usage: Do :help fortran-indent from Vim | 7 " Usage: Do :help fortran-indent from Vim |
8 | 8 |
9 " Only load this indent file when no other was loaded. | 9 " Only load this indent file when no other was loaded. |
10 if exists("b:did_indent") | 10 if exists("b:did_indent") |
12 endif | 12 endif |
13 let b:did_indent = 1 | 13 let b:did_indent = 1 |
14 | 14 |
15 setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select | 15 setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select |
16 setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect | 16 setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect |
17 setlocal indentkeys+==~type,=~interface | |
17 | 18 |
18 " Determine whether this is a fixed or free format source file | 19 " Determine whether this is a fixed or free format source file |
19 " if this hasn't been done yet | 20 " if this hasn't been done yet |
20 if !exists("b:fortran_fixed_source") | 21 if !exists("b:fortran_fixed_source") |
21 if exists("fortran_free_source") | 22 if exists("fortran_free_source") |
79 let ind = ind - &sw | 80 let ind = ind - &sw |
80 endif | 81 endif |
81 endif | 82 endif |
82 | 83 |
83 "Add a shiftwidth to statements following if, else, case, | 84 "Add a shiftwidth to statements following if, else, case, |
84 "where and elsewhere statements | 85 "where, elsewhere, type and interface statements |
85 if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(else\|case\|where\|elsewhere\)\>' | 86 if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(else\|case\|where\|elsewhere\)\>' |
87 \ ||prevstat =~? '^\s*\(\d\+\s\)\=\s*\(type\|interface\)\>' | |
86 \ || prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' | 88 \ || prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' |
87 let ind = ind + &sw | 89 let ind = ind + &sw |
88 " Remove unwanted indent after logical and arithmetic ifs | 90 " Remove unwanted indent after logical and arithmetic ifs |
89 if prevstat =~? '\<if\>' && prevstat !~? '\<then\>' | 91 if prevstat =~? '\<if\>' && prevstat !~? '\<then\>' |
90 let ind = ind - &sw | 92 let ind = ind - &sw |
91 endif | 93 endif |
94 " Remove unwanted indent after type( statements | |
95 if prevstat =~? '\<type\s*(' | |
96 let ind = ind - &sw | |
97 endif | |
92 endif | 98 endif |
93 | 99 |
94 "Subtract a shiftwidth from else, elsewhere, case, end if, | 100 "Subtract a shiftwidth from else, elsewhere, case, end if, |
95 " end where and end select statements | 101 " end where, end select, end interface and end type statements |
96 if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*' | 102 if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*' |
97 \. '\(else\|elsewhere\|case\|end\s*\(if\|where\|select\)\)\>' | 103 \. '\(else\|elsewhere\|case\|end\s*\(if\|where\|select\|interface\|type\)\)\>' |
98 let ind = ind - &sw | 104 let ind = ind - &sw |
99 " Fix indent for case statement immediately after select | 105 " Fix indent for case statement immediately after select |
100 if prevstat =~? '\<select\>' | 106 if prevstat =~? '\<select\>' |
101 let ind = ind + &sw | 107 let ind = ind + &sw |
102 endif | 108 endif |