ft_ada.txt 18 KB

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