neovim

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

ada.vim (6937B)


      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: This runtime file is looking for a new maintainer.
      6 "   Previous Maintainer: Martin Krischik <krischik@users.sourceforge.net>
      7 "		Taylor Venable <taylor@metasyntax.net>
      8 "		Neil Bird <neil@fnxweb.com>
      9 "      $Author: krischik $
     10 "	 $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
     11 "      Version: 4.6 with patch from David Bürgin
     12 "    $Revision: 887 $
     13 "     $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/ftplugin/ada.vim $
     14 "      History: 24.05.2006 MK Unified Headers
     15 "		26.05.2006 MK ' should not be in iskeyword.
     16 "		16.07.2006 MK Ada-Mode as vim-ball
     17 "		02.10.2006 MK Better folding.
     18 "		15.10.2006 MK Bram's suggestion for runtime integration
     19 "               05.11.2006 MK Bram suggested not to use include protection for
     20 "                             autoload
     21 "		05.11.2006 MK Bram suggested to save on spaces
     22 "		08.07.2007 TV fix default compiler problems.
     23 "		05.09.2025    do not globally set 'ignorecase'/'smartcase' option
     24 "			      set undo_ftplugin
     25 "			      mark as unmaintained
     26 "			      use buffer-local abbreviation
     27 "    Help Page: ft-ada-plugin
     28 "------------------------------------------------------------------------------
     29 " Provides mapping overrides for tag jumping that figure out the current
     30 " Ada object and tag jump to that, not the 'simple' vim word.
     31 " Similarly allows <Ctrl-N> matching of full-length ada entities from tags.
     32 "------------------------------------------------------------------------------
     33 
     34 " Only do this when not done yet for this buffer
     35 if exists ("b:did_ftplugin") || version < 700
     36   finish
     37 endif
     38 
     39 " Don't load another plugin for this buffer
     40 let b:did_ftplugin = 45
     41 
     42 "
     43 " Temporarily set cpoptions to ensure the script loads OK
     44 "
     45 let s:cpoptions = &cpoptions
     46 set cpoptions-=C
     47 
     48 " Section: Comments  {{{1
     49 "
     50 setlocal comments=O:--,:--\ \ 
     51 setlocal commentstring=--\ \ %s
     52 setlocal complete=.,w,b,u,t,i
     53 
     54 " Section: case	     {{{1
     55 "
     56 " setlocal nosmartcase
     57 " setlocal ignorecase
     58 
     59 " Section: formatoptions {{{1
     60 "
     61 setlocal formatoptions+=ron
     62 
     63 " Section: Tagging {{{1
     64 "
     65 if exists ("g:ada_extended_tagging")
     66   " Make local tag mappings for this buffer (if not already set)
     67   if g:ada_extended_tagging == 'jump'
     68      if mapcheck('<C-]>','n') == ''
     69  nnoremap <unique> <buffer> <C-]>    :call ada#Jump_Tag ('', 'tjump')<cr>
     70      endif
     71      if mapcheck('g<C-]>','n') == ''
     72  nnoremap <unique> <buffer> g<C-]>   :call ada#Jump_Tag ('','stjump')<cr>
     73      endif
     74   elseif g:ada_extended_tagging == 'list'
     75      if mapcheck('<C-]>','n') == ''
     76  nnoremap <unique> <buffer> <C-]>    :call ada#List_Tag ()<cr>
     77      endif
     78      if mapcheck('g<C-]>','n') == ''
     79  nnoremap <unique> <buffer> g<C-]>   :call ada#List_Tag ()<cr>
     80      endif
     81   endif
     82 endif
     83 
     84 " Section: Completion {{{1
     85 "
     86 setlocal completefunc=ada#User_Complete
     87 setlocal omnifunc=adacomplete#Complete
     88 
     89 if exists ("g:ada_extended_completion")
     90   if mapcheck ('<C-N>','i') == ''
     91      inoremap <unique> <buffer> <C-N> <C-R>=ada#Completion("\<lt>C-N>")<cr>
     92   endif
     93   if mapcheck ('<C-P>','i') == ''
     94      inoremap <unique> <buffer> <C-P> <C-R>=ada#Completion("\<lt>C-P>")<cr>
     95   endif
     96   if mapcheck ('<C-X><C-]>','i') == ''
     97      inoremap <unique> <buffer> <C-X><C-]> <C-R>=<SID>ada#Completion("\<lt>C-X>\<lt>C-]>")<cr>
     98   endif
     99   if mapcheck ('<bs>','i') == ''
    100      inoremap <silent> <unique> <buffer> <bs> <C-R>=ada#Insert_Backspace ()<cr>
    101   endif
    102 endif
    103 
    104 " Section: Matchit {{{1
    105 "
    106 " Only do this when not done yet for this buffer & matchit is used
    107 "
    108 if !exists ("b:match_words")  &&
    109  \ exists ("loaded_matchit")
    110   "
    111   " The following lines enable the matchit.vim plugin for
    112   " Ada-specific extended matching with the % key.
    113   "
    114   let s:notend      = '\%(\<end\s\+\)\@<!'
    115   let b:match_words =
    116      \ s:notend . '\<if\>:\<elsif\>:\<else\>:\<end\>\s\+\<if\>,' .
    117      \ s:notend . '\<case\>:\<when\>:\<end\>\s\+\<case\>,' .
    118      \ '\%(\<while\>.*\|\<for\>.*\|'.s:notend.'\)\<loop\>:\<end\>\s\+\<loop\>,' .
    119      \ '\%(\<do\>\|\<begin\>\):\<exception\>:\<end\>\s*\%($\|[;A-Z]\),' .
    120      \ s:notend . '\<record\>:\<end\>\s\+\<record\>'
    121 endif
    122 
    123 " Section: Compiler {{{1
    124 "
    125 if ! exists("g:ada_default_compiler")
    126   let g:ada_default_compiler = 'gnat'
    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 <buffer> ret	return
    156   iabbrev <buffer> proc procedure
    157   iabbrev <buffer> pack package
    158   iabbrev <buffer> func function
    159 endif
    160 
    161 " Section: Commands, Mapping, Menus {{{1
    162 if !exists(':AdaTagFile')
    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 endif
    197 "
    198 " Section: b:undo_ftplugin {{{1
    199 let b:undo_ftplugin = "setl fo< comments< tw< commentstring< complete< "
    200 \ . "| setl completefunc< omnifunc< ts< sts< sw< fdm< fde< fdi< "
    201 \ . "| setl fdm< fde< fdi< fdn< "
    202 \ . "| unlet! b:match_words "
    203 
    204 " 1}}}
    205 " Reset cpoptions
    206 let &cpoptions = s:cpoptions
    207 unlet s:cpoptions
    208 
    209 finish " 1}}}
    210 
    211 "------------------------------------------------------------------------------
    212 "   Copyright (C) 2006	Martin Krischik
    213 "
    214 "   Vim is Charityware - see ":help license" or uganda.txt for licence details.
    215 "------------------------------------------------------------------------------
    216 " vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
    217 " vim: foldmethod=marker