neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

ft_ada.txt (17436B)


      1 *ft_ada.txt*	Nvim
      2 
      3 
      4 	    ADA FILE TYPE PLUG-INS REFERENCE MANUAL~
      5 
      6 ADA								*ft-ada-syntax*
      7 
      8                                      Type |gO| to see the table of contents.
      9 
     10 ==============================================================================
     11 1. Syntax Highlighting ~
     12 
     13 This mode is designed for the 2005 edition of Ada ("Ada 2005"), which includes
     14 support for objected-programming, protected types, and so on.  It handles code
     15 written for the original Ada language ("Ada83", "Ada87", "Ada95") as well,
     16 though code which uses Ada 2005-only keywords will be wrongly colored (such
     17 code should be fixed anyway).  For more information about Ada, see
     18 http://www.adapower.com.
     19 
     20 The Ada mode handles a number of situations cleanly.
     21 
     22 For example, it knows that the "-" in "-5" is a number, but the same character
     23 in "A-5" is an operator.  Normally, a "with" or "use" clause referencing
     24 another compilation unit is coloured the same way as C's "#include" is coloured.
     25 If you have "Conditional" or "Repeat" groups coloured differently, then "end
     26 if" and "end loop" will be coloured as part of those respective groups.
     27 
     28 You can set these to different colours using vim's "highlight" command (e.g.,
     29 to change how loops are displayed, enter the command ":hi Repeat" followed by
     30 the colour specification; on simple terminals the colour specification
     31 ctermfg=White often shows well).
     32 
     33 There are several options you can select in this Ada mode. See |ft-ada-options|
     34 for a complete list.
     35 
     36 To enable them, assign a value to the option.  For example, to turn one on: >
     37 let g:ada_standard_types = 1
     38 <
     39 To disable them use ":unlet".  Example: >
     40 unlet g:ada_standard_types
     41 <
     42 You can just use ":" and type these into the command line to set these
     43 temporarily before loading an Ada file.  You can make these option settings
     44 permanent by adding the "let" command(s), without a colon, to your |init.vim|
     45 file.
     46 
     47 Even on a slow (90Mhz) PC this mode works quickly, but if you find the
     48 performance unacceptable, turn on |g:ada_withuse_ordinary|.
     49 
     50 Syntax folding instructions (|fold-syntax|) are added when |g:ada_folding| is
     51 set.
     52 
     53 ==============================================================================
     54 2. File type Plug-in ~
     55 				       *ft-ada-indent* *ft-ada-plugin*
     56 
     57 The 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 
     67 The plug-in only activates the features of the Ada mode whenever an Ada
     68 file is opened and adds Ada related entries to the main and pop-up menu.
     69 
     70 ==============================================================================
     71 3. Omni Completion ~
     72 							 *ft-ada-omni*
     73 
     74 The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either
     75 by "gnat xref -v" or the "Universal Ctags" (https://ctags.io).  The complete
     76 function will automatically detect which tool was used to create the tags
     77 file.
     78 
     79 ------------------------------------------------------------------------------
     80 3.1 Omni Completion with "gnat xref" ~
     81 							   *gnat-xref*
     82 
     83 GNAT XREF uses the compiler internal information (ali-files) to produce the
     84 tags file. This has the advantage to be 100% correct and the option of deep
     85 nested analysis. However the code must compile, the generator is quite
     86 slow and the created tags file contains only the basic Ctags information for
     87 each entry - not enough for some of the more advanced Vim code browser
     88 plug-ins.
     89 
     90 NOTE: "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 
     94 1)  You need to compile your code first and use the "-aO" option to point to
     95    your .ali files.
     96 2)  "gnat xref -v ../Include/adacl.ads" won't work - use  the "gnat xref -v
     97    -aI../Include adacl.ads" instead.
     98 3)  `gnat xref -v -aI../Include *.ad?` won't work - use "cd ../Include" and
     99    then `gnat xref -v *.ad?`
    100 4)  Project manager support is completely broken - don't even try "gnat xref
    101    -Padacl.gpr".
    102 5)  Vim is faster when the tags file is sorted - use "sort --unique
    103    --ignore-case --output=tags tags" .
    104 6)  Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
    105    the file assorted.
    106 
    107 ------------------------------------------------------------------------------
    108 3.2 Omni Completion with "ctags"~
    109 							   *ada-ctags*
    110 
    111 Universal/Exuberant Ctags use their own multi-language code parser.  The
    112 parser is quite fast, produces a lot of extra information and can run on files
    113 which currently do not compile.
    114 
    115 There are also lots of other Vim-tools which use Universal/Exuberant Ctags.
    116 Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
    117 
    118 You will need to install Universal Ctags which is available from
    119 https://ctags.io
    120 
    121 The Ada parser for Universal/Exuberant Ctags is fairly new - don't expect
    122 complete support yet.
    123 
    124 ==============================================================================
    125 4. Compiler Support ~
    126 							*ada-compiler*
    127 
    128 The Ada mode supports more than one Ada compiler and will automatically load the
    129 compiler set in |g:ada_default_compiler| whenever an Ada source is opened. The
    130 provided compiler plug-ins are split into the actual compiler plug-in and a
    131 collection of support functions and variables. This allows the easy
    132 development of specialized compiler plug-ins fine tuned to your development
    133 environment.
    134 
    135 ------------------------------------------------------------------------------
    136 4.1 GNAT ~
    137 						       *compiler-gnat*
    138 
    139 GNAT is the only free (beer and speech) Ada compiler available. There are
    140 several versions available which differ in the licence terms used.
    141 
    142 The GNAT compiler plug-in will perform a compile on pressing <F7> and then
    143 immediately shows the result. You can set the project file to be used by
    144 setting: >
    145 	call g:gnat.Set_Project_File ('my_project.gpr')
    146 <
    147 Setting a project file will also create a Vim session (|views-sessions|) so -
    148 like with the GPS - opened files, window positions etc. will be remembered
    149 separately for all projects.
    150 
    151 							*gnat_members*
    152 GNAT OBJECT ~
    153 
    154 						       *g:gnat.Make()*
    155 g:gnat.Make()
    156 	Calls |g:gnat.Make_Command| and displays the result inside a
    157 	|quickfix| window.
    158 
    159 						     *g:gnat.Pretty()*
    160 g:gnat.Pretty()
    161 	Calls |g:gnat.Pretty_Program|
    162 
    163 						       *g:gnat.Find()*
    164 g:gnat.Find()
    165 	Calls |g:gnat.Find_Program|
    166 
    167 						       *g:gnat.Tags()*
    168 g:gnat.Tags()
    169 	Calls |g:gnat.Tags_Command|
    170 
    171 					   *g:gnat.Set_Project_File()*
    172 g: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*
    180 g:gnat.Project_File	string
    181 	Current project file.
    182 
    183 						 *g:gnat.Make_Command*
    184 g:gnat.Make_Command	string
    185 	External command used for |g:gnat.Make()| ('makeprg').
    186 
    187 					       *g:gnat.Pretty_Program*
    188 g:gnat.Pretty_Program	string
    189 	External command used for |g:gnat.Pretty()|
    190 
    191 						 *g:gnat.Find_Program*
    192 g:gnat.Find_Program	string
    193 	External command used for |g:gnat.Find()|
    194 
    195 						 *g:gnat.Tags_Command*
    196 g:gnat.Tags_Command	string
    197 	External command used for |g:gnat.Tags()|
    198 
    199 						 *g:gnat.Error_Format*
    200 g:gnat.Error_Format	string
    201 	Error format ('errorformat')
    202 
    203 ------------------------------------------------------------------------------
    204 4.2 Dec Ada ~
    205 				    *compiler-hpada* *compiler-decada*
    206 				*compiler-vaxada* *compiler-compaqada*
    207 
    208 Dec Ada (also known by - in chronological order - VAX Ada, Dec Ada, Compaq Ada
    209 and HP Ada) is a fairly dated Ada 83 compiler. Support is basic: <F7> will
    210 compile the current unit.
    211 
    212 The Dec Ada compiler expects the package name and not the file name to be
    213 passed as a parameter. The compiler plug-in supports the usual file name
    214 convention to convert the file into a unit name. Both '-' and '__' are allowed
    215 as separators.
    216 
    217 						      *decada_members*
    218 DEC ADA OBJECT ~
    219 
    220 						     *g:decada.Make()*
    221 g:decada.Make()		function
    222 	Calls |g:decada.Make_Command| and displays the result inside a
    223 	|quickfix| window.
    224 
    225 						*g:decada.Unit_Name()*
    226 g:decada.Unit_Name()	function
    227 	Get the Unit name for the current file.
    228 
    229 					       *g:decada.Make_Command*
    230 g:decada.Make_Command	string
    231 	External command used for |g:decada.Make()| ('makeprg').
    232 
    233 					       *g:decada.Error_Format*
    234 g:decada.Error_Format	string
    235 	Error format ('errorformat').
    236 
    237 ==============================================================================
    238 5. References ~
    239 						       *ada-reference*
    240 
    241 ------------------------------------------------------------------------------
    242 5.1 Options ~
    243 						      *ft-ada-options*
    244 
    245 						*g:ada_standard_types*
    246 g: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*
    253 g: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*
    263 g: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*
    268 g: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*
    273 g: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*
    297 g: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*
    302 g: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*
    308 g: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*
    313 g: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*
    319 g: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*
    328 g: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*
    335 g:ada_gnat_extensions	  bool (true when exists)
    336 	 Support GNAT extensions.
    337 
    338 				       *g:ada_with_gnat_project_files*
    339 g:ada_with_gnat_project_files	 bool (true when exists)
    340 	 Add gnat project file keywords and Attributes.
    341 
    342 					      *g:ada_default_compiler*
    343 g:ada_default_compiler	  string
    344 	set default compiler. Currently supported are "gnat" and
    345 	"decada".
    346 
    347 An "exists" type is a boolean considered true when the variable is defined and
    348 false when the variable is undefined. The value to which the variable is set
    349 makes no difference.
    350 
    351 ------------------------------------------------------------------------------
    352 5.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 ------------------------------------------------------------------------------
    384 5.3 Variables ~
    385 						    *ft-ada-variables*
    386 
    387 							      *g:gnat*
    388 g: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*
    395 g: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 ------------------------------------------------------------------------------
    402 5.4 Constants ~
    403 						    *ft-ada-constants*
    404 
    405 All constants are locked. See |:lockvar| for details.
    406 
    407 						     *g:ada#WordRegex*
    408 g:ada#WordRegex		string
    409 	Regular expression to search for Ada words.
    410 
    411 						  *g:ada#DotWordRegex*
    412 g:ada#DotWordRegex	string
    413 	Regular expression to search for Ada words separated by dots.
    414 
    415 						       *g:ada#Comment*
    416 g:ada#Comment		string
    417 	Regular expression to search for Ada comments.
    418 
    419 						      *g:ada#Keywords*
    420 g: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*
    425 g:ada#Ctags_Kinds	dictionary of lists
    426 	Dictionary of the various kinds of items which the Ada support
    427 	for Ctags generates.
    428 
    429 ------------------------------------------------------------------------------
    430 5.5 Functions ~
    431 						    *ft-ada-functions*
    432 
    433 ada#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 
    437 ada#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 
    441 ada#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 
    446 ada#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 
    451 gnat#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 
    455 ada#Switch_Syntax_Option ({option})		  *ada#Switch_Syntax_Option()*
    456 	Toggles highlighting options on or off. Used for the Ada menu.
    457 
    458 							  *gnat#New()*
    459 gnat#New ()
    460 	Create a new gnat object. See |g:gnat| for details.
    461 
    462 
    463 ==============================================================================
    464 6. Extra Plugins ~
    465 						   *ada-extra-plugins*
    466 
    467 You can optionally install the following extra plug-ins. They work well with
    468 Ada and enhance the ability of the Ada mode:
    469 
    470 backup.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 
    474 rainbow_parenthesis.vim
    475 https://www.vim.org/scripts/script.php?script_id=1561
    476 Very helpful since Ada uses only '(' and ')'.
    477 
    478 nerd_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 
    483 matchit.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 
    488 taglist.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 
    492 The GNU Ada Project distribution (https://sourceforge.net/projects/gnuada/) of Vim
    493 contains all of the above.
    494 
    495 vim:tw=78:ts=8:noet:ft=help:norl: