robin/laufey

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

Justin M. KeyesMerge #36741 from justinmk/doc262dd74d472

master
17.0 KiB495 linesraw
1*ft_ada.txt*	Nvim
2
3
4		    ADA FILE TYPE PLUG-INS REFERENCE MANUAL~
5
6ADA								*ft-ada-syntax*
7
8                                      Type |gO| to see the table of contents.
9
10==============================================================================
111. Syntax Highlighting ~
12
13This mode is designed for the 2005 edition of Ada ("Ada 2005"), which includes
14support for objected-programming, protected types, and so on.  It handles code
15written for the original Ada language ("Ada83", "Ada87", "Ada95") as well,
16though code which uses Ada 2005-only keywords will be wrongly colored (such
17code should be fixed anyway).  For more information about Ada, see
18http://www.adapower.com.
19
20The Ada mode handles a number of situations cleanly.
21
22For example, it knows that the "-" in "-5" is a number, but the same character
23in "A-5" is an operator.  Normally, a "with" or "use" clause referencing
24another compilation unit is coloured the same way as C's "#include" is coloured.
25If you have "Conditional" or "Repeat" groups coloured differently, then "end
26if" and "end loop" will be coloured as part of those respective groups.
27
28You can set these to different colours using vim's "highlight" command (e.g.,
29to change how loops are displayed, enter the command ":hi Repeat" followed by
30the colour specification; on simple terminals the colour specification
31ctermfg=White often shows well).
32
33There are several options you can select in this Ada mode. See |ft-ada-options|
34for a complete list.
35
36To enable them, assign a value to the option.  For example, to turn one on: >
37	let g:ada_standard_types = 1
38<
39To disable them use ":unlet".  Example: >
40	unlet g:ada_standard_types
41<
42You can just use ":" and type these into the command line to set these
43temporarily before loading an Ada file.  You can make these option settings
44permanent by adding the "let" command(s), without a colon, to your |init.vim|
45file.
46
47Even on a slow (90Mhz) PC this mode works quickly, but if you find the
48performance unacceptable, turn on |g:ada_withuse_ordinary|.
49
50Syntax folding instructions (|fold-syntax|) are added when |g:ada_folding| is
51set.
52
53==============================================================================
542. File type Plug-in ~
55					       *ft-ada-indent* *ft-ada-plugin*
56
57The Ada plug-in provides support for:
58
59 - auto indenting	(|indent.txt|)
60 - insert completion	(|i_CTRL-N|)
61 - user completion	(|i_CTRL-X_CTRL-U|)
62 - tag searches		(|tagsrch.txt|)
63 - Quick Fix		(|quickfix.txt|)
64 - backspace handling	('backspace')
65 - comment handling	('comments', 'commentstring')
66
67The plug-in only activates the features of the Ada mode whenever an Ada
68file is opened and adds Ada related entries to the main and pop-up menu.
69
70==============================================================================
713. Omni Completion ~
72								 *ft-ada-omni*
73
74The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either
75by "gnat xref -v" or the "Universal Ctags" (https://ctags.io).  The complete
76function will automatically detect which tool was used to create the tags
77file.
78
79------------------------------------------------------------------------------
803.1 Omni Completion with "gnat xref" ~
81								   *gnat-xref*
82
83GNAT XREF uses the compiler internal information (ali-files) to produce the
84tags file. This has the advantage to be 100% correct and the option of deep
85nested analysis. However the code must compile, the generator is quite
86slow and the created tags file contains only the basic Ctags information for
87each entry - not enough for some of the more advanced Vim code browser
88plug-ins.
89
90NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
91       output - If nothing is printed then usually the parameters are wrong.
92       Here some important tips:
93
941)  You need to compile your code first and use the "-aO" option to point to
95    your .ali files.
962)  "gnat xref -v ../Include/adacl.ads" won't work - use  the "gnat xref -v
97    -aI../Include adacl.ads" instead.
983)  `gnat xref -v -aI../Include *.ad?` won't work - use "cd ../Include" and
99    then `gnat xref -v *.ad?`
1004)  Project manager support is completely broken - don't even try "gnat xref
101    -Padacl.gpr".
1025)  Vim is faster when the tags file is sorted - use "sort --unique
103    --ignore-case --output=tags tags" .
1046)  Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
105    the file assorted.
106
107------------------------------------------------------------------------------
1083.2 Omni Completion with "ctags"~
109								   *ada-ctags*
110
111Universal/Exuberant Ctags use their own multi-language code parser.  The
112parser is quite fast, produces a lot of extra information and can run on files
113which currently do not compile.
114
115There are also lots of other Vim-tools which use Universal/Exuberant Ctags.
116Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
117
118You will need to install Universal Ctags which is available from
119https://ctags.io
120
121The Ada parser for Universal/Exuberant Ctags is fairly new - don't expect
122complete support yet.
123
124==============================================================================
1254. Compiler Support ~
126								*ada-compiler*
127
128The Ada mode supports more than one Ada compiler and will automatically load the
129compiler set in |g:ada_default_compiler| whenever an Ada source is opened. The
130provided compiler plug-ins are split into the actual compiler plug-in and a
131collection of support functions and variables. This allows the easy
132development of specialized compiler plug-ins fine tuned to your development
133environment.
134
135------------------------------------------------------------------------------
1364.1 GNAT ~
137							       *compiler-gnat*
138
139GNAT is the only free (beer and speech) Ada compiler available. There are
140several versions available which differ in the licence terms used.
141
142The GNAT compiler plug-in will perform a compile on pressing <F7> and then
143immediately shows the result. You can set the project file to be used by
144setting: >
145		call g:gnat.Set_Project_File ('my_project.gpr')
146<
147Setting a project file will also create a Vim session (|views-sessions|) so -
148like with the GPS - opened files, window positions etc. will be remembered
149separately for all projects.
150
151								*gnat_members*
152GNAT OBJECT ~
153
154							       *g:gnat.Make()*
155g:gnat.Make()
156		Calls |g:gnat.Make_Command| and displays the result inside a
157		|quickfix| window.
158
159							     *g:gnat.Pretty()*
160g:gnat.Pretty()
161		Calls |g:gnat.Pretty_Program|
162
163							       *g:gnat.Find()*
164g:gnat.Find()
165		Calls |g:gnat.Find_Program|
166
167							       *g:gnat.Tags()*
168g:gnat.Tags()
169		Calls |g:gnat.Tags_Command|
170
171						   *g:gnat.Set_Project_File()*
172g:gnat.Set_Project_File([{file}])
173		Set gnat project file and load associated session.  An open
174		project will be closed and the session written.  If called
175		without file name the file selector opens for selection of a
176		project file. If called with an empty string then the project
177		and associated session are closed.
178
179							 *g:gnat.Project_File*
180g:gnat.Project_File	string
181		Current project file.
182
183							 *g:gnat.Make_Command*
184g:gnat.Make_Command	string
185		External command used for |g:gnat.Make()| ('makeprg').
186
187						       *g:gnat.Pretty_Program*
188g:gnat.Pretty_Program	string
189		External command used for |g:gnat.Pretty()|
190
191							 *g:gnat.Find_Program*
192g:gnat.Find_Program	string
193		External command used for |g:gnat.Find()|
194
195							 *g:gnat.Tags_Command*
196g:gnat.Tags_Command	string
197		External command used for |g:gnat.Tags()|
198
199							 *g:gnat.Error_Format*
200g:gnat.Error_Format	string
201		Error format ('errorformat')
202
203------------------------------------------------------------------------------
2044.2 Dec Ada ~
205					    *compiler-hpada* *compiler-decada*
206					*compiler-vaxada* *compiler-compaqada*
207
208Dec Ada (also known by - in chronological order - VAX Ada, Dec Ada, Compaq Ada
209and HP Ada) is a fairly dated Ada 83 compiler. Support is basic: <F7> will
210compile the current unit.
211
212The Dec Ada compiler expects the package name and not the file name to be
213passed as a parameter. The compiler plug-in supports the usual file name
214convention to convert the file into a unit name. Both '-' and '__' are allowed
215as separators.
216
217							      *decada_members*
218DEC ADA OBJECT ~
219
220							     *g:decada.Make()*
221g:decada.Make()		function
222		Calls |g:decada.Make_Command| and displays the result inside a
223		|quickfix| window.
224
225							*g:decada.Unit_Name()*
226g:decada.Unit_Name()	function
227		Get the Unit name for the current file.
228
229						       *g:decada.Make_Command*
230g:decada.Make_Command	string
231		External command used for |g:decada.Make()| ('makeprg').
232
233						       *g:decada.Error_Format*
234g:decada.Error_Format	string
235		Error format ('errorformat').
236
237==============================================================================
2385. References ~
239							       *ada-reference*
240
241------------------------------------------------------------------------------
2425.1 Options ~
243							      *ft-ada-options*
244
245							*g:ada_standard_types*
246g:ada_standard_types	bool (true when exists)
247		Highlight types in package Standard (e.g., "Float").
248
249							  *g:ada_space_errors*
250						  *g:ada_no_trail_space_error*
251						    *g:ada_no_tab_space_error*
252							 *g:ada_all_tab_usage*
253g:ada_space_errors	 bool (true when exists)
254		Highlight extraneous errors in spaces ...
255		g:ada_no_trail_space_error
256		    - but ignore trailing spaces at the end of a line
257		g:ada_no_tab_space_error
258		    - but ignore tabs after spaces
259		g:ada_all_tab_usage
260		    - highlight all tab use
261
262							   *g:ada_line_errors*
263g:ada_line_errors	  bool (true when exists)
264		Highlight lines which are too long. Note: This highlighting
265		option is quite CPU intensive.
266
267							 *g:ada_rainbow_color*
268g:ada_rainbow_color	  bool (true when exists)
269		Use rainbow colours for '(' and ')'. You need the
270		rainbow_parenthesis for this to work.
271
272							       *g:ada_folding*
273g:ada_folding		  set ("sigpft")
274		Use folding for Ada sources.
275		    's':    activate syntax folding on load
276			'p':    fold packages
277			'f':    fold functions and procedures
278			't':    fold types
279			'c':    fold conditionals
280		    'g':    activate gnat pretty print folding on load
281			'i':    lone "is" folded with line above
282			'b':	lone "begin" folded with line above
283			'p':	lone "private" folded with line above
284			'x':	lone "exception" folded with line above
285		    'i':    activate indent folding on load
286
287		Note: Syntax folding is in an early (unusable) stage and
288		      indent or gnat pretty folding is suggested.
289
290		For gnat pretty folding to work the following settings are
291		suggested: -cl3 -M79 -c2 -c3 -c4 -A1 -A2 -A3 -A4 -A5
292
293		For indent folding to work the following settings are
294		suggested: shiftwidth=3 softtabstop=3
295
296								*g:ada_abbrev*
297g:ada_abbrev		  bool (true when exists)
298		Add some abbreviations. This feature is more or less superseded
299		by the various completion methods.
300
301						      *g:ada_withuse_ordinary*
302g:ada_withuse_ordinary	  bool (true when exists)
303		Show "with" and "use" as ordinary keywords (when used to
304		reference other compilation units they're normally highlighted
305		specially).
306
307							 *g:ada_begin_preproc*
308g:ada_begin_preproc	  bool (true when exists)
309		Show all begin-like keywords using the colouring of C
310		preprocessor commands.
311
312						    *g:ada_omni_with_keywords*
313g:ada_omni_with_keywords
314		Add Keywords, Pragmas, Attributes to omni-completions
315		(|compl-omni|). Note: You can always complete then with user
316		completion (|i_CTRL-X_CTRL-U|).
317
318						      *g:ada_extended_tagging*
319g:ada_extended_tagging	  enum ("jump", "list")
320		use extended tagging, two options are available
321		    "jump": use tjump to jump.
322		    "list": add tags quick fix list.
323		Normal tagging does not support function or operator
324		overloading as these features are not available in C and
325		tagging was originally developed for C.
326
327						   *g:ada_extended_completion*
328g:ada_extended_completion
329		Uses extended completion for <C-N> and <C-R> completions
330		(|i_CTRL-N|). In this mode the '.' is used as part of the
331		identifier so that 'Object.Method' or 'Package.Procedure' are
332		completed together.
333
334						       *g:ada_gnat_extensions*
335g:ada_gnat_extensions	  bool (true when exists)
336		 Support GNAT extensions.
337
338					       *g:ada_with_gnat_project_files*
339g:ada_with_gnat_project_files	 bool (true when exists)
340		 Add gnat project file keywords and Attributes.
341
342						      *g:ada_default_compiler*
343g:ada_default_compiler	  string
344		set default compiler. Currently supported are "gnat" and
345		"decada".
346
347An "exists" type is a boolean considered true when the variable is defined and
348false when the variable is undefined. The value to which the variable is set
349makes no difference.
350
351------------------------------------------------------------------------------
3525.2 Commands ~
353							     *ft-ada-commands*
354
355:AdaRainbow							 *:AdaRainbow*
356		Toggles rainbow colour (|g:ada_rainbow_color|) mode for
357		'(' and ')'.
358
359:AdaLines							   *:AdaLines*
360		Toggles line error (|g:ada_line_errors|) display.
361
362:AdaSpaces							  *:AdaSpaces*
363		Toggles space error (|g:ada_space_errors|) display.
364
365:AdaTagDir							  *:AdaTagDir*
366		Creates tags file for the directory of the current file.
367
368:AdaTagFile							 *:AdaTagFile*
369		Creates tags file for the current file.
370
371:AdaTypes							   *:AdaTypes*
372		Toggles standard types (|g:ada_standard_types|) colour.
373
374:GnatFind							   *:GnatFind*
375		Calls |g:gnat.Find()|
376
377:GnatPretty							 *:GnatPretty*
378		Calls |g:gnat.Pretty()|
379
380:GnatTags							   *:GnatTags*
381		Calls |g:gnat.Tags()|
382
383------------------------------------------------------------------------------
3845.3 Variables ~
385							    *ft-ada-variables*
386
387								      *g:gnat*
388g:gnat			    object
389		Control object which manages GNAT compiles.  The object
390		is created when the first Ada source code is loaded provided
391		that |g:ada_default_compiler| is set to "gnat". See
392		|gnat_members| for details.
393
394								    *g:decada*
395g:decada		      object
396		Control object which manages Dec Ada compiles.	The object
397		is created when the first Ada source code is loaded provided
398		that |g:ada_default_compiler| is set to "decada". See
399		|decada_members| for details.
400
401------------------------------------------------------------------------------
4025.4 Constants ~
403							    *ft-ada-constants*
404
405All constants are locked. See |:lockvar| for details.
406
407							     *g:ada#WordRegex*
408g:ada#WordRegex		string
409		Regular expression to search for Ada words.
410
411							  *g:ada#DotWordRegex*
412g:ada#DotWordRegex	string
413		Regular expression to search for Ada words separated by dots.
414
415							       *g:ada#Comment*
416g:ada#Comment		string
417		Regular expression to search for Ada comments.
418
419							      *g:ada#Keywords*
420g:ada#Keywords		list of dictionaries
421		List of keywords, attributes etc. pp. in the format used by
422		omni completion. See |complete-items| for details.
423
424							   *g:ada#Ctags_Kinds*
425g:ada#Ctags_Kinds	dictionary of lists
426		Dictionary of the various kinds of items which the Ada support
427		for Ctags generates.
428
429------------------------------------------------------------------------------
4305.5 Functions ~
431							    *ft-ada-functions*
432
433ada#Word([{line}, {col}])					  *ada#Word()*
434		Return full name of Ada entity under the cursor (or at given
435		line/column), stripping white space/newlines as necessary.
436
437ada#List_Tag([{line}, {col}])				      *ada#Listtags()*
438		List all occurrences of the Ada entity under the cursor (or at
439		given line/column) inside the quick-fix window.
440
441ada#Jump_Tag ({ident}, {mode})				      *ada#Jump_Tag()*
442		List all occurrences of the Ada entity under the cursor (or at
443		given line/column) in the tag jump list. Mode can either be
444		"tjump" or "stjump".
445
446ada#Create_Tags ({option})				   *ada#Create_Tags()*
447		Creates tag file using Ctags. The option can either be "file"
448		for the current file, "dir" for the directory of the current
449		file or a file name.
450
451gnat#Insert_Tags_Header()			   *gnat#Insert_Tags_Header()*
452		Adds the tag file header (!_TAG_) information to the current
453		file which are missing from the GNAT XREF output.
454
455ada#Switch_Syntax_Option ({option})		  *ada#Switch_Syntax_Option()*
456		Toggles highlighting options on or off. Used for the Ada menu.
457
458								  *gnat#New()*
459gnat#New ()
460		Create a new gnat object. See |g:gnat| for details.
461
462
463==============================================================================
4646. Extra Plugins ~
465							   *ada-extra-plugins*
466
467You can optionally install the following extra plug-ins. They work well with
468Ada and enhance the ability of the Ada mode:
469
470backup.vim
471	https://www.vim.org/scripts/script.php?script_id=1537
472	Keeps as many backups as you like so you don't have to.
473
474rainbow_parenthesis.vim
475	https://www.vim.org/scripts/script.php?script_id=1561
476	Very helpful since Ada uses only '(' and ')'.
477
478nerd_comments.vim
479	https://www.vim.org/scripts/script.php?script_id=1218
480	Excellent commenting and uncommenting support for almost any
481	programming language.
482
483matchit.vim
484	https://www.vim.org/scripts/script.php?script_id=39
485	'%' jumping for any language. The normal '%' jump only works for '{}'
486	style languages. The Ada mode will set the needed search patterns.
487
488taglist.vim
489	https://www.vim.org/scripts/script.php?script_id=273
490	Source code explorer sidebar. There is a patch for Ada available.
491
492The GNU Ada Project distribution (https://sourceforge.net/projects/gnuada/) of Vim
493contains all of the above.
494
495 vim:tw=78:ts=8:noet:ft=help:norl: