annotate runtime/ftplugin/fortran.vim @ 5774:0a295a3c9e47 v7.4.231

updated for version 7.4.231 Problem: An error in ":options" is not caught by the tests. Solution: Add a test for ":options". Set $VIMRUNTIME for the tests so that it uses the current runtime files instead of the installed ones.
author Bram Moolenaar <bram@vim.org>
date Tue, 01 Apr 2014 14:08:28 +0200
parents 173c9c860e42
children aea5ebf352c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim settings file
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
2 " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66)
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
3 " Version: 0.49
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
4 " Last Change: 2013 Oct. 01
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
5 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Usage: Do :help fortran-plugin from Vim
2398
0c8219a26bc9 More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 819
diff changeset
7 " Credits:
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
8 " Useful suggestions were made by Stefano Zacchiroli, Hendrik Merx, Ben
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
9 " Fritz, and David Barnett.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Only do these settings when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2398
diff changeset
16 let s:cposet=&cpoptions
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2398
diff changeset
17 set cpoptions&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2398
diff changeset
18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Don't do other file type settings for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " Determine whether this is a fixed or free format source file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " if this hasn't been done yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 if !exists("b:fortran_fixed_source")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 if exists("fortran_free_source")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " User guarantees free source form
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let b:fortran_fixed_source = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 elseif exists("fortran_fixed_source")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " User guarantees fixed source form
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 let b:fortran_fixed_source = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 else
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
32 " Modern Fortran allows both fixed and free source form
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " assume fixed source form unless signs of free source form
2398
0c8219a26bc9 More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 819
diff changeset
34 " are detected in the first five columns of the first s:lmax lines
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Detection becomes more accurate and time-consuming if more lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " are checked. Increase the limit below if you keep lots of comments at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " the very top of each file and you have a fast computer
2398
0c8219a26bc9 More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 819
diff changeset
38 let s:lmax = 500
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if ( s:lmax > line("$") )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 let s:lmax = line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 let b:fortran_fixed_source = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 let s:ln=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 while s:ln <= s:lmax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 let s:test = strpart(getline(s:ln),0,5)
2398
0c8219a26bc9 More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 819
diff changeset
46 if s:test !~ '^[Cc*]' && s:test !~ '^ *[!#]' && s:test =~ '[^ 0-9\t]' && s:test !~ '^[ 0-9]*\t'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 let b:fortran_fixed_source = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 let s:ln = s:ln + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 endwhile
2398
0c8219a26bc9 More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 819
diff changeset
52 unlet! s:lmax s:ln s:test
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 " Set comments and textwidth according to source type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 if (b:fortran_fixed_source == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 setlocal comments=:!,:*,:C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " Fixed format requires a textwidth of 72 for code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 setlocal tw=72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 " If you need to add "&" on continued lines so that the code is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " compatible with both free and fixed format, then you should do so
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " in column 73 and uncomment the next line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " setlocal tw=73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 setlocal comments=:!
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
67 " Free format allows a textwidth of 132
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
68 setlocal tw=132
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " Set commentstring for foldmethod=marker
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 setlocal cms=!%s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 " Tabs are not a good idea in Fortran so the default is to expand tabs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 if !exists("fortran_have_tabs")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 setlocal expandtab
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
79 " Set 'formatoptions' to break text lines
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
80 setlocal fo+=t
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 7
diff changeset
82 setlocal include=^\\c#\\=\\s*include\\s\\+
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
83 setlocal suffixesadd+=.f08,.f03,.f95,.f90,.for,.f,.F,.f77,.ftn,.fpp
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " Define patterns for the matchit plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 if !exists("b:match_words")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 let s:notend = '\%(\<end\s\+\)\@<!'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let s:notselect = '\%(\<select\s\+\)\@<!'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 let s:notelse = '\%(\<end\s\+\|\<else\s\+\)\@<!'
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 7
diff changeset
90 let s:notprocedure = '\%(\s\+procedure\>\)\@!'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let b:match_ignorecase = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let b:match_words =
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
93 \ '(:),' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 \ '\<select\s*case\>:' . s:notselect. '\<case\>:\<end\s*select\>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 \ s:notelse . '\<if\s*(.\+)\s*then\>:' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 \ '\<else\s*\%(if\s*(.\+)\s*then\)\=\>:\<end\s*if\>,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 \ 'do\s\+\(\d\+\):\%(^\s*\)\@<=\1\s,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 \ s:notend . '\<do\>:\<end\s*do\>,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 \ s:notelse . '\<where\>:\<elsewhere\>:\<end\s*where\>,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 \ s:notend . '\<type\s*[^(]:\<end\s*type\>,'.
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
101 \ s:notend . '\<forall\>:\<end\s*forall\>,'.
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
102 \ s:notend . '\<associate\>:\<end\s*associate\>,'.
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
103 \ s:notend . '\<enum\>:\<end\s*enum\>,'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 \ s:notend . '\<interface\>:\<end\s*interface\>,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 \ s:notend . '\<subroutine\>:\<end\s*subroutine\>,'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 \ s:notend . '\<function\>:\<end\s*function\>,'.
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 7
diff changeset
107 \ s:notend . '\<module\>' . s:notprocedure . ':\<end\s*module\>,'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 \ s:notend . '\<program\>:\<end\s*program\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 " File filters for :browse e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 if has("gui_win32") && !exists("b:browsefilter")
3492
3482d151136b Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
113 let b:browsefilter = "Fortran Files (*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn)\t*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn\n" .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 \ "All Files (*.*)\t*.*\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3492
diff changeset
117 let b:undo_ftplugin = "setl fo< com< tw< cms< et< inc< sua<"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 \ . "| unlet! b:match_ignorecase b:match_words b:browsefilter"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 let &cpoptions=s:cposet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 unlet s:cposet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 " vim:sw=2