annotate runtime/ftplugin/ada.vim @ 1029:82b2594be408 v7.0.155

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