robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #40472 from zeertzjq/vim-1f337327945732ed7

master
6.9 KiB221 linesraw
1"------------------------------------------------------------------------------
2"  Description: Perform Ada specific completion & tagging.
3"     Language: Ada (2005)
4"	   $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $
5"   Maintainer: This runtime file is looking for a new maintainer.
6"   Previous Maintainer: Martin Krischik <krischik@users.sourceforge.net>
7"		Taylor Venable <taylor@metasyntax.net>
8"		Neil Bird <neil@fnxweb.com>
9"      $Author: krischik $
10"	 $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
11"      Version: 4.6 with patch from David Bürgin
12"    $Revision: 887 $
13"     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/ftplugin/ada.vim $
14"      History: 24.05.2006 MK Unified Headers
15"		26.05.2006 MK ' should not be in iskeyword.
16"		16.07.2006 MK Ada-Mode as vim-ball
17"		02.10.2006 MK Better folding.
18"		15.10.2006 MK Bram's suggestion for runtime integration
19"               05.11.2006 MK Bram suggested not to use include protection for
20"                             autoload
21"		05.11.2006 MK Bram suggested to save on spaces
22"		08.07.2007 TV fix default compiler problems.
23"		05.09.2025    do not globally set 'ignorecase'/'smartcase' option
24"			      set undo_ftplugin
25"			      mark as unmaintained
26"			      use buffer-local abbreviation
27"		27.06.2026    add recommended style guard
28"    Help Page: ft-ada-plugin
29"------------------------------------------------------------------------------
30" Provides mapping overrides for tag jumping that figure out the current
31" Ada object and tag jump to that, not the 'simple' vim word.
32" Similarly allows <Ctrl-N> matching of full-length ada entities from tags.
33"------------------------------------------------------------------------------
34
35" Only do this when not done yet for this buffer
36if exists ("b:did_ftplugin") || version < 700
37   finish
38endif
39
40" Don't load another plugin for this buffer
41let b:did_ftplugin = 45
42
43"
44" Temporarily set cpoptions to ensure the script loads OK
45"
46let s:cpoptions = &cpoptions
47set cpoptions-=C
48
49" Section: Comments  {{{1
50"
51setlocal comments=O:--,:--\ \ 
52setlocal commentstring=--\ \ %s
53setlocal complete=.,w,b,u,t,i
54
55" Section: case	     {{{1
56"
57" setlocal nosmartcase
58" setlocal ignorecase
59
60" Section: formatoptions {{{1
61"
62setlocal formatoptions+=ron
63
64" Section: Tagging {{{1
65"
66if exists ("g:ada_extended_tagging")
67   " Make local tag mappings for this buffer (if not already set)
68   if g:ada_extended_tagging == 'jump'
69      if mapcheck('<C-]>','n') == ''
70	 nnoremap <unique> <buffer> <C-]>    :call ada#Jump_Tag ('', 'tjump')<cr>
71      endif
72      if mapcheck('g<C-]>','n') == ''
73	 nnoremap <unique> <buffer> g<C-]>   :call ada#Jump_Tag ('','stjump')<cr>
74      endif
75   elseif g:ada_extended_tagging == 'list'
76      if mapcheck('<C-]>','n') == ''
77	 nnoremap <unique> <buffer> <C-]>    :call ada#List_Tag ()<cr>
78      endif
79      if mapcheck('g<C-]>','n') == ''
80	 nnoremap <unique> <buffer> g<C-]>   :call ada#List_Tag ()<cr>
81      endif
82   endif
83endif
84
85" Section: Completion {{{1
86"
87setlocal completefunc=ada#User_Complete
88setlocal omnifunc=adacomplete#Complete
89
90if exists ("g:ada_extended_completion")
91   if mapcheck ('<C-N>','i') == ''
92      inoremap <unique> <buffer> <C-N> <C-R>=ada#Completion("\<lt>C-N>")<cr>
93   endif
94   if mapcheck ('<C-P>','i') == ''
95      inoremap <unique> <buffer> <C-P> <C-R>=ada#Completion("\<lt>C-P>")<cr>
96   endif
97   if mapcheck ('<C-X><C-]>','i') == ''
98      inoremap <unique> <buffer> <C-X><C-]> <C-R>=<SID>ada#Completion("\<lt>C-X>\<lt>C-]>")<cr>
99   endif
100   if mapcheck ('<bs>','i') == ''
101      inoremap <silent> <unique> <buffer> <bs> <C-R>=ada#Insert_Backspace ()<cr>
102   endif
103endif
104
105" Section: Matchit {{{1
106"
107" Only do this when not done yet for this buffer & matchit is used
108"
109if !exists ("b:match_words")  &&
110  \ exists ("loaded_matchit")
111   "
112   " The following lines enable the matchit.vim plugin for
113   " Ada-specific extended matching with the % key.
114   "
115   let s:notend      = '\%(\<end\s\+\)\@<!'
116   let b:match_words =
117      \ s:notend . '\<if\>:\<elsif\>:\<else\>:\<end\>\s\+\<if\>,' .
118      \ s:notend . '\<case\>:\<when\>:\<end\>\s\+\<case\>,' .
119      \ '\%(\<while\>.*\|\<for\>.*\|'.s:notend.'\)\<loop\>:\<end\>\s\+\<loop\>,' .
120      \ '\%(\<do\>\|\<begin\>\):\<exception\>:\<end\>\s*\%($\|[;A-Z]\),' .
121      \ s:notend . '\<record\>:\<end\>\s\+\<record\>'
122endif
123
124" Section: Compiler {{{1
125"
126if ! exists("g:ada_default_compiler")
127   let g:ada_default_compiler = 'gnat'
128endif
129
130if ! exists("current_compiler")			||
131   \ current_compiler != g:ada_default_compiler
132   execute "compiler " . g:ada_default_compiler
133endif
134
135" Section: Folding {{{1
136"
137if exists("g:ada_folding")
138   if g:ada_folding[0] == 'i'
139      setlocal foldmethod=indent
140      setlocal foldignore=--
141      setlocal foldnestmax=5
142   elseif g:ada_folding[0] == 'g'
143      setlocal foldmethod=expr
144      setlocal foldexpr=ada#Pretty_Print_Folding(v:lnum)
145   elseif g:ada_folding[0] == 's'
146      setlocal foldmethod=syntax
147   endif
148   if get(g:, 'ada_recommended_style',
149   \ get(g:, 'filetype_recommended_style', 1))
150      setlocal tabstop=8
151      setlocal softtabstop=3
152      setlocal shiftwidth=3
153   endif
154endif
155
156" Section: Abbrev {{{1
157"
158if exists("g:ada_abbrev")
159   iabbrev <buffer> ret	return
160   iabbrev <buffer> proc procedure
161   iabbrev <buffer> pack package
162   iabbrev <buffer> func function
163endif
164
165" Section: Commands, Mapping, Menus {{{1
166if !exists(':AdaTagFile')
167  call ada#Map_Popup (
168     \ 'Tag.List',
169     \  'l',
170     \ 'call ada#List_Tag ()')
171  call ada#Map_Popup (
172     \'Tag.Jump',
173     \'j',
174     \'call ada#Jump_Tag ()')
175  call ada#Map_Menu (
176     \'Tag.Create File',
177     \':AdaTagFile',
178     \'call ada#Create_Tags (''file'')')
179  call ada#Map_Menu (
180     \'Tag.Create Dir',
181     \':AdaTagDir',
182     \'call ada#Create_Tags (''dir'')')
183
184  call ada#Map_Menu (
185     \'Highlight.Toggle Space Errors',
186     \ ':AdaSpaces',
187     \'call ada#Switch_Syntax_Option (''space_errors'')')
188  call ada#Map_Menu (
189     \'Highlight.Toggle Lines Errors',
190     \ ':AdaLines',
191     \'call ada#Switch_Syntax_Option (''line_errors'')')
192  call ada#Map_Menu (
193     \'Highlight.Toggle Rainbow Color',
194     \ ':AdaRainbow',
195     \'call ada#Switch_Syntax_Option (''rainbow_color'')')
196  call ada#Map_Menu (
197     \'Highlight.Toggle Standard Types',
198     \ ':AdaTypes',
199     \'call ada#Switch_Syntax_Option (''standard_types'')')
200endif
201"
202" Section: b:undo_ftplugin {{{1
203let b:undo_ftplugin = "setl fo< comments< tw< commentstring< complete< "
204	\ . "| setl completefunc< omnifunc< ts< sts< sw< fdm< fde< fdi< "
205	\ . "| setl fdm< fde< fdi< fdn< "
206	\ . "| unlet! b:match_words "
207
208" 1}}}
209" Reset cpoptions
210let &cpoptions = s:cpoptions
211unlet s:cpoptions
212
213finish " 1}}}
214
215"------------------------------------------------------------------------------
216"   Copyright (C) 2006	Martin Krischik
217"
218"   Vim is Charityware - see ":help license" or uganda.txt for licence details.
219"------------------------------------------------------------------------------
220" vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
221" vim: foldmethod=marker