home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / runtime / dos / ftplugin / ada.vim < prev    next >
Encoding:
Text File  |  2010-08-15  |  6.4 KB  |  211 lines

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