annotate runtime/ftplugin/ada.vim @ 44:af1bcb9a13c0

updated for version 7.0027
author vimboss
date Fri, 31 Dec 2004 20:56:11 +0000
parents 3fc0f57ecb91
children 1f3b1021f002
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 Ada plugin file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Ada
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Neil Bird <neil@fnxweb.com>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Last Change: 2003 May 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Version: $Id$
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Look for the latest version at http://vim.sourceforge.net/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Perform Ada specific completion & tagging.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Provides mapping overrides for tag jumping that figure out the current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " Ada object and tag jump to that, not the 'simple' vim word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " Similarly allows <Ctrl-N> matching of full-length ada entities from tags.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " Exports 'AdaWord()' function to return full name of Ada entity under the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " cursor( or at given line/column), stripping whitespace/newlines as necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " Only do this when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " Don't load another plugin for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Temporarily set cpoptions to ensure the script loads OK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let s:cpoptions = &cpoptions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 set cpo-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " Ada comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 setlocal comments+=O:--
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Make local tag mappings for this buffer (if not already set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 if mapcheck('<C-]>','n') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 nnoremap <unique> <buffer> <C-]> :call JumpToTag_ada('')<cr>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if mapcheck('g<C-]>','n') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 nnoremap <unique> <buffer> g<C-]> :call JumpToTag_ada('','stj')<cr>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 if mapcheck('<C-N>','i') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 inoremap <unique> <buffer> <C-N> <C-R>=<SID>AdaCompletion("\<lt>C-N>")<cr>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 if mapcheck('<C-P>','i') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 inoremap <unique> <buffer> <C-P> <C-R>=<SID>AdaCompletion("\<lt>C-P>")<cr>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 if mapcheck('<C-X><C-]>','i') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 inoremap <unique> <buffer> <C-X><C-]> <C-R>=<SID>AdaCompletion("\<lt>C-X>\<lt>C-]>")<cr>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 if mapcheck('<bs>','i') == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 inoremap <silent> <unique> <buffer> <bs> <C-R>=<SID>AdaInsertBackspace()<cr>
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " Only do this when not done yet for this buffer & matchit is used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 if ! exists("b:match_words") && exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " The following lines enable the macros/matchit.vim plugin for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " Ada-specific extended matching with the % key.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 let s:notend = '\%(\<end\s\+\)\@<!'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 let b:match_words=
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 \ s:notend . '\<if\>:\<elsif\>:\<else\>:\<end\>\s\+\<if\>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 \ s:notend . '\<case\>:\<when\>:\<end\>\s\+\<case\>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 \ '\%(\<while\>.*\|\<for\>.*\|'.s:notend.'\)\<loop\>:\<end\>\s\+\<loop\>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 \ '\%(\<do\>\|\<begin\>\):\<exception\>:\<end\>\s*\%($\|[;A-Z]\),' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 \ s:notend . '\<record\>:\<end\>\s\+\<record\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " Prevent re-load of functions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 if exists('s:id')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " Get this script's unique id
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 map <script> <SID>?? <SID>??
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 let s:id = substitute( maparg('<SID>??'), '^<SNR>\(.*\)_??$', '\1', '' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 unmap <script> <SID>??
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " Extract current Ada word across multiple lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " AdaWord( [line, column] )\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let s:AdaWordRegex = '\a\w*\(\_s*\.\_s*\a\w*\)*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 let s:AdaComment = "\\v^(\"[^\"]*\"|'.'|[^\"']){-}\\zs\\s*--.*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 function! AdaWord(...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 if a:0 > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 let linenr = a:1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let colnr = a:2 - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let linenr = line('.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 let colnr = col('.') - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let line = substitute( getline(linenr), s:AdaComment, '', '' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 " Cope with tag searching for items in comments; if we are, don't loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " backards looking for previous lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 if colnr > strlen(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 " We were in a comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 let line = getline(linenr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 let search_prev_lines = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 let search_prev_lines = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 " Go backwards until we find a match (Ada ID) that *doesn't* include our
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " location - i.e., the previous ID. This is because the current 'correct'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 " match will toggle matching/not matching as we traverse characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 " backwards. Thus, we have to find the previous unrelated match, exclude
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 " it, then use the next full match (ours).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 " Remember to convert vim column 'colnr' [1..n] to string offset [0..(n-1)]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 " ... but start, here, one after the required char.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 let newcol = colnr + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 let newcol = newcol - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 if newcol < 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 " Have to include previous line from file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 let linenr = linenr - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 if linenr < 1 || !search_prev_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 " Start of file or matching in a comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 let linenr = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 let newcol = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 let ourmatch = match( line, s:AdaWordRegex )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 " Get previous line, and prepend it to our search string
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 let newline = substitute( getline(linenr), s:AdaComment, '', '' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 let newcol = strlen(newline) - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 let colnr = colnr + newcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 let line = newline . line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 " Check to see if this is a match excluding 'us'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 let mend = newcol + matchend( strpart(line,newcol), s:AdaWordRegex ) - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 if mend >= newcol && mend < colnr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 " Yes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 let ourmatch = mend+1 + match( strpart(line,mend+1), s:AdaWordRegex )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 " Got anything?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 if ourmatch < 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 return ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 let line = strpart( line, ourmatch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 " Now simply add further lines until the match gets no bigger
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 let matchstr = matchstr( line, s:AdaWordRegex )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 let lastline = line('$')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 let linenr = line('.') + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 while linenr <= lastline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 let lastmatch = matchstr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 let line = line . substitute( getline(linenr), s:AdaComment, '', '' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 let matchstr = matchstr( line, s:AdaWordRegex )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 if matchstr == lastmatch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " Strip whitespace & return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 return substitute( matchstr, '\s\+', '', 'g' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 " Word tag - include '.' and if Ada make uppercase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 " Name allows a common JumpToTag() to look for an ft specific JumpToTag_ft().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 function! JumpToTag_ada(word,...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 if a:word == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 " Get current word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 let word = AdaWord()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 if word == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 let word = a:word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 if a:0 > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 let mode = a:1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 let mode = 'tj'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 let v:errmsg = ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 execute 'silent!' mode word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 if v:errmsg != ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 if v:errmsg =~ '^E426:' " Tag not found
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 let ignorecase = &ignorecase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 set ignorecase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 execute mode word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 let &ignorecase = ignorecase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 " Repeat to give error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 execute mode word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 " Word completion (^N/^R/^X^]) - force '.' inclusion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 function! s:AdaCompletion(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 set iskeyword+=46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 return a:cmd . "\<C-R>=<SNR>" . s:id . "_AdaCompletionEnd()\<CR>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 function! s:AdaCompletionEnd()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 set iskeyword-=46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 return ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 " Backspace at end of line after auto-inserted commentstring '-- ' wipes it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 function! s:AdaInsertBackspace()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 let line = getline('.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 if col('.') > strlen(line) && match(line,'-- $') != -1 && match(&comments,'--') != -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 return "\<bs>\<bs>\<bs>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 return "\<bs>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 " Reset cpoptions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 let &cpoptions = s:cpoptions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 unlet s:cpoptions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 " vim: sts=2 sw=2 :