annotate runtime/ftplugin/zimbu.vim @ 3526:dd6c2497c997

Fix more 'cpo' issues in runtime files.
author Bram Moolenaar <bram@vim.org>
date Fri, 18 May 2012 21:49:28 +0200
parents 1b584a6f446c
children 04592728474a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: Zimbu
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3513
diff changeset
4 " Last Change: 2012 May 18
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Only do this when not done yet for this buffer
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 if exists("b:did_ftplugin")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 finish
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 " Don't load another plugin for this buffer
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 let b:did_ftplugin = 1
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 " Using line continuation here.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 let s:cpo_save = &cpo
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 set cpo-=C
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3513
diff changeset
18 let b:undo_ftplugin = "setl fo< com< ofu< efm< tw< et< sts< sw< | if has('vms') | setl isk< | endif"
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " Set 'formatoptions' to break comment lines but not other lines,
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 " and insert the comment leader when hitting <CR> or using "o".
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 setlocal fo-=t fo+=croql
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 " Set completion with CTRL-X CTRL-O to autoloaded function.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 if exists('&ofu')
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 setlocal ofu=ccomplete#Complete
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 " Set 'comments' to format dashed lists in comments.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 " And to keep Zudocu comment characters.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 setlocal comments=sO:#\ -,mO:#\ \ ,:#=,:#-,:#%,:#
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 setlocal errorformat^=%f\ line\ %l\ col\ %c:\ %m,ERROR:\ %m
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 " When the matchit plugin is loaded, this makes the % command skip parens and
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 " braces in comments.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 let b:match_words = '\(^\s*\)\@<=\(MODULE\|CLASS\|INTERFACE\|BITS\|ENUM\|SHARED\|FUNC\|REPLACE\|DEFINE\|PROC\|EQUAL\|MAIN\|IF\|GENERATE_IF\|WHILE\|REPEAT\|WITH\|DO\|FOR\|SWITCH\|TRY\)\>\|{\s*$:\(^\s*\)\@<=\(ELSE\|ELSEIF\|GENERATE_ELSE\|GENERATE_ELSEIF\|CATCH\|FINALLY\)\>:\(^\s*\)\@<=}\|\<UNTIL\>'
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 let b:match_skip = 's:comment\|string\|zimbuchar'
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 setlocal tw=78
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 setlocal et sts=2 sw=2
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 " Does replace when a dot, space or closing brace is typed.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 func! GCUpperDot(what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 let col = col(".") - strlen(a:what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 if v:char != ' ' && v:char != "\r" && v:char != "\x1b" && v:char != '.' && v:char != ')' && v:char != '}'
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 " no space or dot after the typed text
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 let g:got_char = v:char
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 return a:what
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 if col > 1 && getline('.')[col - 2] != ' '
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 " no space before the typed text
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 let g:got_char = 999
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 return a:what
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 let synName = synIDattr(synID(line("."), col(".") - 2, 1), "name")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 if synName =~ 'Comment\|String\|zimbuCregion\|\<c'
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 " inside a comment or C code
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 let g:got_char = 777
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 return a:what
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 let g:got_char = 1111
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 return toupper(a:what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 endfunc
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 " Does not replace when a dot is typed.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 func! GCUpper(what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 if v:char != ' ' && v:char != "\r" && v:char != "\x1b" && v:char != ')'
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 " no space after the typed text
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 let g:got_char = v:char
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 return a:what
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 return GCUpperDot(a:what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 endfunc
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 " Only replaces when a space is typed.
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 func! GCUpperSpace(what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 if v:char != ' '
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 " no space after the typed text
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 let g:got_char = v:char
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 return a:what
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 endif
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 return GCUpperDot(a:what)
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 endfunc
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 iabbr <buffer> <expr> alias GCUpperSpace("alias")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 iabbr <buffer> <expr> arg GCUpperDot("arg")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 iabbr <buffer> <expr> bad GCUpper("bad")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 iabbr <buffer> <expr> break GCUpper("break")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 iabbr <buffer> <expr> case GCUpperSpace("case")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 iabbr <buffer> <expr> catch GCUpperSpace("catch")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93 iabbr <buffer> <expr> check GCUpperDot("check")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 iabbr <buffer> <expr> class GCUpperSpace("class")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 iabbr <buffer> <expr> shared GCUpperSpace("shared")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 iabbr <buffer> <expr> continue GCUpper("continue")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 iabbr <buffer> <expr> default GCUpper("default")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98 iabbr <buffer> <expr> extends GCUpper("extends")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99 iabbr <buffer> <expr> do GCUpper("do")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 iabbr <buffer> <expr> else GCUpper("else")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 iabbr <buffer> <expr> elseif GCUpperSpace("elseif")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 iabbr <buffer> <expr> enum GCUpperSpace("enum")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103 iabbr <buffer> <expr> exit GCUpper("exit")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 iabbr <buffer> <expr> false GCUpper("false")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
105 iabbr <buffer> <expr> fail GCUpper("fail")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 iabbr <buffer> <expr> finally GCUpper("finally")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 iabbr <buffer> <expr> for GCUpperSpace("for")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 iabbr <buffer> <expr> func GCUpperSpace("func")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 iabbr <buffer> <expr> if GCUpperSpace("if")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 iabbr <buffer> <expr> import GCUpperSpace("import")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111 iabbr <buffer> <expr> in GCUpperSpace("in")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112 iabbr <buffer> <expr> io GCUpperDot("io")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 iabbr <buffer> <expr> main GCUpper("main")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 iabbr <buffer> <expr> module GCUpperSpace("module")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115 iabbr <buffer> <expr> new GCUpper("new")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 iabbr <buffer> <expr> nil GCUpper("nil")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117 iabbr <buffer> <expr> ok GCUpper("ok")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
118 iabbr <buffer> <expr> proc GCUpperSpace("proc")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 iabbr <buffer> <expr> proceed GCUpper("proceed")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 iabbr <buffer> <expr> return GCUpper("return")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 iabbr <buffer> <expr> step GCUpperSpace("step")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 iabbr <buffer> <expr> switch GCUpperSpace("switch")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123 iabbr <buffer> <expr> sys GCUpperDot("sys")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 iabbr <buffer> <expr> this GCUpperDot("this")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
125 iabbr <buffer> <expr> throw GCUpperSpace("throw")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126 iabbr <buffer> <expr> try GCUpper("try")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
127 iabbr <buffer> <expr> to GCUpperSpace("to")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 iabbr <buffer> <expr> true GCUpper("true")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 iabbr <buffer> <expr> until GCUpperSpace("until")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130 iabbr <buffer> <expr> while GCUpperSpace("while")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
131 iabbr <buffer> <expr> repeat GCUpper("repeat")
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
132
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
133 nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR>
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
134 nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR>
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
135
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
136 " Using a function makes sure the search pattern is restored
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
137 func! ZimbuGoStartBlock()
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
138 ?^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\>
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
139 endfunc
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
140 func! ZimbuGoEndBlock()
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141 /^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\>
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142 endfunc
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
145 let &cpo = s:cpo_save
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
146 unlet s:cpo_save