codekingpro/portable-devtools
114k
1*ft_ada.txt* For Vim version 9.2. Last change: 2026 Feb 142 3 4 ADA FILE TYPE PLUG-INS REFERENCE MANUAL~5 6ADA *ada.vim*7 81. Syntax Highlighting |ft-ada-syntax|92. File type Plug-in |ft-ada-plugin|103. Omni Completion |ft-ada-omni|11 3.1 Omni Completion with "gnat xref" |gnat-xref|12 3.2 Omni Completion with "ctags" |ada-ctags|134. Compiler Support |ada-compiler|14 4.1 GNAT |compiler-gnat|15 4.2 Dec Ada |compiler-decada|165. References |ada-reference|17 5.1 Options |ft-ada-options|18 5.2 Commands |ft-ada-commands|19 5.3 Variables |ft-ada-variables|20 5.4 Constants |ft-ada-constants|21 5.5 Functions |ft-ada-functions|226. Extra Plug-ins |ada-extra-plugins|23 24==============================================================================251. Syntax Highlighting ~26 *ft-ada-syntax*27 28This mode is designed for the 2005 edition of Ada ("Ada 2005"), which includes29support for objected-programming, protected types, and so on. It handles code30written for the original Ada language ("Ada83", "Ada87", "Ada95") as well,31though code which uses Ada 2005-only keywords will be wrongly colored (such32code should be fixed anyway). For more information about Ada, see33http://www.adapower.com.34 35The Ada mode handles a number of situations cleanly.36 37For example, it knows that the "-" in "-5" is a number, but the same character38in "A-5" is an operator. Normally, a "with" or "use" clause referencing39another compilation unit is coloured the same way as C's "#include" is coloured.40If you have "Conditional" or "Repeat" groups coloured differently, then "end41if" and "end loop" will be coloured as part of those respective groups.42 43You can set these to different colours using vim's "highlight" command (e.g.,44to change how loops are displayed, enter the command ":hi Repeat" followed by45the colour specification; on simple terminals the colour specification46ctermfg=White often shows well).47 48There are several options you can select in this Ada mode. See |ft-ada-options|49for a complete list.50 51To enable them, assign a value to the option. For example, to turn one on: >52 let g:ada_standard_types = 153<54To disable them use ":unlet". Example: >55 unlet g:ada_standard_types56<57You can just use ":" and type these into the command line to set these58temporarily before loading an Ada file. You can make these option settings59permanent by adding the "let" command(s), without a colon, to your "~/.vimrc"60file.61 62Even on a slow (90Mhz) PC this mode works quickly, but if you find the63performance unacceptable, turn on |g:ada_withuse_ordinary|.64 65Syntax folding instructions (|fold-syntax|) are added when |g:ada_folding| is66set.67 68==============================================================================692. File type Plug-in ~70 *ft-ada-indent* *ft-ada-plugin*71 72The Ada plug-in provides support for:73 74 - auto indenting (|indent.txt|)75 - insert completion (|i_CTRL-N|)76 - user completion (|i_CTRL-X_CTRL-U|)77 - tag searches (|tagsrch.txt|)78 - Quick Fix (|quickfix.txt|)79 - backspace handling ('backspace')80 - comment handling ('comments', 'commentstring')81 82The plug-in only activates the features of the Ada mode whenever an Ada83file is opened and adds Ada related entries to the main and pop-up menu.84 85==============================================================================863. Omni Completion ~87 *ft-ada-omni*88 89The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either90by "gnat xref -v" or the "Universal Ctags" (https://ctags.io). The complete91function will automatically detect which tool was used to create the tags92file.93 94------------------------------------------------------------------------------953.1 Omni Completion with "gnat xref" ~96 *gnat-xref*97 98GNAT XREF uses the compiler internal information (ali-files) to produce the99tags file. This has the advantage to be 100% correct and the option of deep100nested analysis. However the code must compile, the generator is quite101slow and the created tags file contains only the basic Ctags information for102each entry - not enough for some of the more advanced Vim code browser103plug-ins.104 105NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic106 output - If nothing is printed then usually the parameters are wrong.107 Here some important tips:108 1091) You need to compile your code first and use the "-aO" option to point to110 your .ali files.1112) "gnat xref -v ../Include/adacl.ads" won't work - use the "gnat xref -v112 -aI../Include adacl.ads" instead.1133) "gnat xref -v -aI../Include *.ad?" won't work - use "cd ../Include" and114 then "gnat xref -v *.ad?"1154) Project manager support is completely broken - don't even try "gnat xref116 -Padacl.gpr".1175) Vim is faster when the tags file is sorted - use "sort --unique118 --ignore-case --output=tags tags" .1196) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark120 the file assorted.121 122------------------------------------------------------------------------------1233.2 Omni Completion with "ctags"~124 *ada-ctags*125 126Universal/Exuberant Ctags use their own multi-language code parser. The127parser is quite fast, produces a lot of extra information and can run on files128which currently do not compile.129 130There are also lots of other Vim-tools which use Universal/Exuberant Ctags.131Universal Ctags is preferred, Exuberant Ctags is no longer being developed.132 133You will need to install Universal Ctags which is available from134https://ctags.io135 136The Ada parser for Universal/Exuberant Ctags is fairly new - don't expect137complete support yet.138 139==============================================================================1404. Compiler Support ~141 *ada-compiler*142 143The Ada mode supports more than one Ada compiler and will automatically load the144compiler set in |g:ada_default_compiler| whenever an Ada source is opened. The145provided compiler plug-ins are split into the actual compiler plug-in and a146collection of support functions and variables. This allows the easy147development of specialized compiler plug-ins fine tuned to your development148environment.149 150------------------------------------------------------------------------------1514.1 GNAT ~152 *compiler-gnat*153 154GNAT is the only free (beer and speech) Ada compiler available. There are155several versions available which differ in the licence terms used.156 157The GNAT compiler plug-in will perform a compile on pressing <F7> and then158immediately shows the result. You can set the project file to be used by159setting: >160 call g:gnat.Set_Project_File ('my_project.gpr')161<162Setting a project file will also create a Vim session (|views-sessions|) so -163like with the GPS - opened files, window positions etc. will be remembered164separately for all projects.165 166 *gnat_members*167GNAT OBJECT ~168 169 *g:gnat.Make()*170g:gnat.Make()171 Calls |g:gnat.Make_Command| and displays the result inside a172 |quickfix| window.173 174 *g:gnat.Pretty()*175g:gnat.Pretty()176 Calls |g:gnat.Pretty_Program|177 178 *g:gnat.Find()*179g:gnat.Find()180 Calls |g:gnat.Find_Program|181 182 *g:gnat.Tags()*183g:gnat.Tags()184 Calls |g:gnat.Tags_Command|185 186 *g:gnat.Set_Project_File()*187g:gnat.Set_Project_File([{file}])188 Set gnat project file and load associated session. An open189 project will be closed and the session written. If called190 without file name the file selector opens for selection of a191 project file. If called with an empty string then the project192 and associated session are closed.193 194 *g:gnat.Project_File*195g:gnat.Project_File string196 Current project file.197 198 *g:gnat.Make_Command*199g:gnat.Make_Command string200 External command used for |g:gnat.Make()| ('makeprg').201 202 *g:gnat.Pretty_Program*203g:gnat.Pretty_Program string204 External command used for |g:gnat.Pretty()|205 206 *g:gnat.Find_Program*207g:gnat.Find_Program string208 External command used for |g:gnat.Find()|209 210 *g:gnat.Tags_Command*211g:gnat.Tags_Command string212 External command used for |g:gnat.Tags()|213 214 *g:gnat.Error_Format*215g:gnat.Error_Format string216 Error format ('errorformat')217 218------------------------------------------------------------------------------2194.2 Dec Ada ~220 *compiler-hpada* *compiler-decada*221 *compiler-vaxada* *compiler-compaqada*222 223Dec Ada (also known by - in chronological order - VAX Ada, Dec Ada, Compaq Ada224and HP Ada) is a fairly dated Ada 83 compiler. Support is basic: <F7> will225compile the current unit.226 227The Dec Ada compiler expects the package name and not the file name to be228passed as a parameter. The compiler plug-in supports the usual file name229convention to convert the file into a unit name. Both '-' and '__' are allowed230as separators.231 232 *decada_members*233DEC ADA OBJECT ~234 235 *g:decada.Make()*236g:decada.Make() function237 Calls |g:decada.Make_Command| and displays the result inside a238 |quickfix| window.239 240 *g:decada.Unit_Name()*241g:decada.Unit_Name() function242 Get the Unit name for the current file.243 244 *g:decada.Make_Command*245g:decada.Make_Command string246 External command used for |g:decada.Make()| ('makeprg').247 248 *g:decada.Error_Format*249g:decada.Error_Format string250 Error format ('errorformat').251 252==============================================================================2535. References ~254 *ada-reference*255 256------------------------------------------------------------------------------2575.1 Options ~258 *ft-ada-options*259 260 *g:ada_standard_types*261g:ada_standard_types bool (true when exists)262 Highlight types in package Standard (e.g., "Float").263 264 *g:ada_space_errors*265 *g:ada_no_trail_space_error*266 *g:ada_no_tab_space_error*267 *g:ada_all_tab_usage*268g:ada_space_errors bool (true when exists)269 Highlight extraneous errors in spaces ...270 g:ada_no_trail_space_error271 - but ignore trailing spaces at the end of a line272 g:ada_no_tab_space_error273 - but ignore tabs after spaces274 g:ada_all_tab_usage275 - highlight all tab use276 277 *g:ada_line_errors*278g:ada_line_errors bool (true when exists)279 Highlight lines which are too long. Note: This highlighting280 option is quite CPU intensive.281 282 *g:ada_rainbow_color*283g:ada_rainbow_color bool (true when exists)284 Use rainbow colours for '(' and ')'. You need the285 rainbow_parenthesis for this to work.286 287 *g:ada_folding*288g:ada_folding set ('sigpft')289 Use folding for Ada sources.290 's': activate syntax folding on load291 'p': fold packages292 'f': fold functions and procedures293 't': fold types294 'c': fold conditionals295 'g': activate gnat pretty print folding on load296 'i': lone 'is' folded with line above297 'b': lone 'begin' folded with line above298 'p': lone 'private' folded with line above299 'x': lone 'exception' folded with line above300 'i': activate indent folding on load301 302 Note: Syntax folding is in an early (unusable) stage and303 indent or gnat pretty folding is suggested.304 305 For gnat pretty folding to work the following settings are306 suggested: -cl3 -M79 -c2 -c3 -c4 -A1 -A2 -A3 -A4 -A5307 308 For indent folding to work the following settings are309 suggested: shiftwidth=3 softtabstop=3310 311 *g:ada_abbrev*312g:ada_abbrev bool (true when exists)313 Add some abbreviations. This feature is more or less superseded314 by the various completion methods.315 316 *g:ada_withuse_ordinary*317g:ada_withuse_ordinary bool (true when exists)318 Show "with" and "use" as ordinary keywords (when used to319 reference other compilation units they're normally highlighted320 specially).321 322 *g:ada_begin_preproc*323g:ada_begin_preproc bool (true when exists)324 Show all begin-like keywords using the colouring of C325 preprocessor commands.326 327 *g:ada_omni_with_keywords*328g:ada_omni_with_keywords329 Add Keywords, Pragmas, Attributes to omni-completions330 (|compl-omni|). Note: You can always complete then with user331 completion (|i_CTRL-X_CTRL-U|).332 333 *g:ada_extended_tagging*334g:ada_extended_tagging enum ('jump', 'list')335 use extended tagging, two options are available336 'jump': use tjump to jump.337 'list': add tags quick fix list.338 Normal tagging does not support function or operator339 overloading as these features are not available in C and340 tagging was originally developed for C.341 342 *g:ada_extended_completion*343g:ada_extended_completion344 Uses extended completion for <C-N> and <C-R> completions345 (|i_CTRL-N|). In this mode the '.' is used as part of the346 identifier so that 'Object.Method' or 'Package.Procedure' are347 completed together.348 349 *g:ada_gnat_extensions*350g:ada_gnat_extensions bool (true when exists)351 Support GNAT extensions.352 353 *g:ada_with_gnat_project_files*354g:ada_with_gnat_project_files bool (true when exists)355 Add gnat project file keywords and Attributes.356 357 *g:ada_default_compiler*358g:ada_default_compiler string359 set default compiler. Currently supported are 'gnat' and360 'decada'.361 362An "exists" type is a boolean considered true when the variable is defined and363false when the variable is undefined. The value to which the variable is set364makes no difference.365 366------------------------------------------------------------------------------3675.2 Commands ~368 *ft-ada-commands*369 370:AdaRainbow *:AdaRainbow*371 Toggles rainbow colour (|g:ada_rainbow_color|) mode for372 '(' and ')'.373 374:AdaLines *:AdaLines*375 Toggles line error (|g:ada_line_errors|) display.376 377:AdaSpaces *:AdaSpaces*378 Toggles space error (|g:ada_space_errors|) display.379 380:AdaTagDir *:AdaTagDir*381 Creates tags file for the directory of the current file.382 383:AdaTagFile *:AdaTagFile*384 Creates tags file for the current file.385 386:AdaTypes *:AdaTypes*387 Toggles standard types (|g:ada_standard_types|) colour.388 389:GnatFind *:GnatFind*390 Calls |g:gnat.Find()|391 392:GnatPretty *:GnatPretty*393 Calls |g:gnat.Pretty()|394 395:GnatTags *:GnatTags*396 Calls |g:gnat.Tags()|397 398------------------------------------------------------------------------------3995.3 Variables ~400 *ft-ada-variables*401 402 *g:gnat*403g:gnat object404 Control object which manages GNAT compiles. The object405 is created when the first Ada source code is loaded provided406 that |g:ada_default_compiler| is set to 'gnat'. See407 |gnat_members| for details.408 409 *g:decada*410g:decada object411 Control object which manages Dec Ada compiles. The object412 is created when the first Ada source code is loaded provided413 that |g:ada_default_compiler| is set to 'decada'. See414 |decada_members| for details.415 416------------------------------------------------------------------------------4175.4 Constants ~418 *ft-ada-constants*419 420All constants are locked. See |:lockvar| for details.421 422 *g:ada#WordRegex*423g:ada#WordRegex string424 Regular expression to search for Ada words.425 426 *g:ada#DotWordRegex*427g:ada#DotWordRegex string428 Regular expression to search for Ada words separated by dots.429 430 *g:ada#Comment*431g:ada#Comment string432 Regular expression to search for Ada comments.433 434 *g:ada#Keywords*435g:ada#Keywords list of dictionaries436 List of keywords, attributes etc. pp. in the format used by437 omni completion. See |complete-items| for details.438 439 *g:ada#Ctags_Kinds*440g:ada#Ctags_Kinds dictionary of lists441 Dictionary of the various kinds of items which the Ada support442 for Ctags generates.443 444------------------------------------------------------------------------------4455.5 Functions ~446 *ft-ada-functions*447 448ada#Word([{line}, {col}]) *ada#Word()*449 Return full name of Ada entity under the cursor (or at given450 line/column), stripping white space/newlines as necessary.451 452ada#List_Tag([{line}, {col}]) *ada#Listtags()*453 List all occurrences of the Ada entity under the cursor (or at454 given line/column) inside the quick-fix window.455 456ada#Jump_Tag ({ident}, {mode}) *ada#Jump_Tag()*457 List all occurrences of the Ada entity under the cursor (or at458 given line/column) in the tag jump list. Mode can either be459 'tjump' or 'stjump'.460 461ada#Create_Tags ({option}) *ada#Create_Tags()*462 Creates tag file using Ctags. The option can either be 'file'463 for the current file, 'dir' for the directory of the current464 file or a file name.465 466gnat#Insert_Tags_Header() *gnat#Insert_Tags_Header()*467 Adds the tag file header (!_TAG_) information to the current468 file which are missing from the GNAT XREF output.469 470ada#Switch_Syntax_Option ({option}) *ada#Switch_Syntax_Option()*471 Toggles highlighting options on or off. Used for the Ada menu.472 473 *gnat#New()*474gnat#New ()475 Create a new gnat object. See |g:gnat| for details.476 477 478==============================================================================4796. Extra Plugins ~480 *ada-extra-plugins*481 482You can optionally install the following extra plug-ins. They work well with483Ada and enhance the ability of the Ada mode:484 485backup.vim486 http://www.vim.org/scripts/script.php?script_id=1537487 Keeps as many backups as you like so you don't have to.488 489rainbow_parenthsis.vim490 http://www.vim.org/scripts/script.php?script_id=1561491 Very helpful since Ada uses only '(' and ')'.492 493nerd_comments.vim494 http://www.vim.org/scripts/script.php?script_id=1218495 Excellent commenting and uncommenting support for almost any496 programming language.497 498matchit.vim499 http://www.vim.org/scripts/script.php?script_id=39500 '%' jumping for any language. The normal '%' jump only works for '{}'501 style languages. The Ada mode will set the needed search patterns.502 503taglist.vim504 http://www.vim.org/scripts/script.php?script_id=273505 Source code explorer sidebar. There is a patch for Ada available.506 507The GNU Ada Project distribution (http://gnuada.sourceforge.net) of Vim508contains all of the above.509 510==============================================================================511vim: textwidth=78 nowrap tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab512vim: filetype=help513 