codekingpro/portable-devtools
115k
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ürgin12" $Revision: 887 $13" $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/ftplugin/ada.vim $14" History: 24.05.2006 MK Unified Headers15" 26.05.2006 MK ' should not be in iskeyword.16" 16.07.2006 MK Ada-Mode as vim-ball17" 02.10.2006 MK Better folding.18" 15.10.2006 MK Bram's suggestion for runtime integration19" 05.11.2006 MK Bram suggested not to use include protection for20" autoload21" 05.11.2006 MK Bram suggested to save on spaces22" 08.07.2007 TV fix default compiler problems.23" 05.09.2025 do not globally set 'ignorecase'/'smartcase' option24" set undo_ftplugin25" mark as unmaintained26" use buffer-local abbreviation27" Help Page: ft-ada-plugin28"------------------------------------------------------------------------------29" Provides mapping overrides for tag jumping that figure out the current30" 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 buffer35if exists ("b:did_ftplugin") || version < 70036 finish37endif38 39" Don't load another plugin for this buffer40let b:did_ftplugin = 4541 42"43" Temporarily set cpoptions to ensure the script loads OK44"45let s:cpoptions = &cpoptions46set cpoptions-=C47 48" Section: Comments {{{149"50setlocal comments=O:--,:--\ \ 51setlocal commentstring=--\ \ %s52setlocal complete=.,w,b,u,t,i53 54" Section: case {{{155"56" setlocal nosmartcase57" setlocal ignorecase58 59" Section: formatoptions {{{160"61setlocal formatoptions+=ron62 63" Section: Tagging {{{164"65if 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 endif71 if mapcheck('g<C-]>','n') == ''72 nnoremap <unique> <buffer> g<C-]> :call ada#Jump_Tag ('','stjump')<cr>73 endif74 elseif g:ada_extended_tagging == 'list'75 if mapcheck('<C-]>','n') == ''76 nnoremap <unique> <buffer> <C-]> :call ada#List_Tag ()<cr>77 endif78 if mapcheck('g<C-]>','n') == ''79 nnoremap <unique> <buffer> g<C-]> :call ada#List_Tag ()<cr>80 endif81 endif82endif83 84" Section: Completion {{{185"86setlocal completefunc=ada#User_Complete87setlocal omnifunc=adacomplete#Complete88 89if 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 endif93 if mapcheck ('<C-P>','i') == ''94 inoremap <unique> <buffer> <C-P> <C-R>=ada#Completion("\<lt>C-P>")<cr>95 endif96 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 endif99 if mapcheck ('<bs>','i') == ''100 inoremap <silent> <unique> <buffer> <bs> <C-R>=ada#Insert_Backspace ()<cr>101 endif102endif103 104" Section: Matchit {{{1105"106" Only do this when not done yet for this buffer & matchit is used107"108if !exists ("b:match_words") &&109 \ exists ("loaded_matchit")110 "111 " The following lines enable the macros/matchit.vim plugin for112 " 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\>'121endif122 123" Section: Compiler {{{1124"125if ! exists("g:ada_default_compiler")126 if has("vms")127 let g:ada_default_compiler = 'decada'128 else129 let g:ada_default_compiler = 'gnat'130 endif131endif132 133if ! exists("current_compiler") ||134 \ current_compiler != g:ada_default_compiler135 execute "compiler " . g:ada_default_compiler136endif137 138" Section: Folding {{{1139"140if exists("g:ada_folding")141 if g:ada_folding[0] == 'i'142 setlocal foldmethod=indent143 setlocal foldignore=--144 setlocal foldnestmax=5145 elseif g:ada_folding[0] == 'g'146 setlocal foldmethod=expr147 setlocal foldexpr=ada#Pretty_Print_Folding(v:lnum)148 elseif g:ada_folding[0] == 's'149 setlocal foldmethod=syntax150 endif151 setlocal tabstop=8152 setlocal softtabstop=3153 setlocal shiftwidth=3154endif155 156" Section: Abbrev {{{1157"158if exists("g:ada_abbrev")159 iabbrev <buffer> ret return160 iabbrev <buffer> proc procedure161 iabbrev <buffer> pack package162 iabbrev <buffer> func function163endif164 165" Section: Commands, Mapping, Menus {{{1166if !exists(':AdaTagFile')167 call ada#Map_Popup (168 \ 'Tag.List',169 \ 'l',170 \ 'call ada#List_Tag ()')171 call ada#Map_Popup (172 \'Tag.Jump',173 \'j',174 \'call ada#Jump_Tag ()')175 call ada#Map_Menu (176 \'Tag.Create File',177 \':AdaTagFile',178 \'call ada#Create_Tags (''file'')')179 call ada#Map_Menu (180 \'Tag.Create Dir',181 \':AdaTagDir',182 \'call ada#Create_Tags (''dir'')')183 184 call ada#Map_Menu (185 \'Highlight.Toggle Space Errors',186 \ ':AdaSpaces',187 \'call ada#Switch_Syntax_Option (''space_errors'')')188 call ada#Map_Menu (189 \'Highlight.Toggle Lines Errors',190 \ ':AdaLines',191 \'call ada#Switch_Syntax_Option (''line_errors'')')192 call ada#Map_Menu (193 \'Highlight.Toggle Rainbow Color',194 \ ':AdaRainbow',195 \'call ada#Switch_Syntax_Option (''rainbow_color'')')196 call ada#Map_Menu (197 \'Highlight.Toggle Standard Types',198 \ ':AdaTypes',199 \'call ada#Switch_Syntax_Option (''standard_types'')')200endif201"202" Section: b:undo_ftplugin {{{1203let b:undo_ftplugin = "setl fo< comments< tw< commentstring< complete< "204 \ . "| setl completefunc< omnifunc< ts< sts< sw< fdm< fde< fdi< "205 \ . "| setl fdm< fde< fdi< fdn< "206 \ . "| unlet! b:match_words "207 208" 1}}}209" Reset cpoptions210let &cpoptions = s:cpoptions211unlet s:cpoptions212 213finish " 1}}}214 215"------------------------------------------------------------------------------216" Copyright (C) 2006 Martin Krischik217"218" Vim is Charityware - see ":help license" or uganda.txt for licence details.219"------------------------------------------------------------------------------220" vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab221" vim: foldmethod=marker222 