Mercurial > vim
comparison runtime/autoload/gnat.vim @ 1125:96cd8222a819
updated for version 7.1a
author | vimboss |
---|---|
date | Sat, 05 May 2007 18:24:42 +0000 |
parents | |
children | 0b796e045c42 |
comparison
equal
deleted
inserted
replaced
1124:da2a955f150a | 1125:96cd8222a819 |
---|---|
1 "------------------------------------------------------------------------------ | |
2 " Description: Vim Ada/GNAT compiler file | |
3 " Language: Ada (GNAT) | |
4 " $Id$ | |
5 " Copyright: Copyright (C) 2006 Martin Krischik | |
6 " Maintainer: Martin Krischik | |
7 " $Author$ | |
8 " $Date$ | |
9 " Version: 4.2 | |
10 " $Revision$ | |
11 " $HeadURL: https://svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/gnat.vim $ | |
12 " History: 24.05.2006 MK Unified Headers | |
13 " 16.07.2006 MK Ada-Mode as vim-ball | |
14 " 05.08.2006 MK Add session support | |
15 " 15.10.2006 MK Bram's suggestion for runtime integration | |
16 " 05.11.2006 MK Bram suggested not to use include protection for | |
17 " autoload | |
18 " 05.11.2006 MK Bram suggested to save on spaces | |
19 " Help Page: compiler-gnat | |
20 "------------------------------------------------------------------------------ | |
21 | |
22 if version < 700 | |
23 finish | |
24 endif | |
25 | |
26 function gnat#Make () dict " {{{1 | |
27 let &l:makeprg = self.Get_Command('Make') | |
28 let &l:errorformat = self.Error_Format | |
29 wall | |
30 make | |
31 copen | |
32 set wrap | |
33 wincmd W | |
34 endfunction gnat#Make " }}}1 | |
35 | |
36 function gnat#Pretty () dict " {{{1 | |
37 execute "!" . self.Get_Command('Pretty') | |
38 endfunction gnat#Make " }}}1 | |
39 | |
40 function gnat#Find () dict " {{{1 | |
41 execute "!" . self.Get_Command('Find') | |
42 endfunction gnat#Find " }}}1 | |
43 | |
44 function gnat#Tags () dict " {{{1 | |
45 execute "!" . self.Get_Command('Tags') | |
46 edit tags | |
47 call gnat#Insert_Tags_Header () | |
48 update | |
49 quit | |
50 endfunction gnat#Tags " }}}1 | |
51 | |
52 function gnat#Set_Project_File (...) dict " {{{1 | |
53 if a:0 > 0 | |
54 let self.Project_File = a:1 | |
55 | |
56 if ! filereadable (self.Project_File) | |
57 let self.Project_File = findfile ( | |
58 \ fnamemodify (self.Project_File, ':r'), | |
59 \ $ADA_PROJECT_PATH, | |
60 \ 1) | |
61 endif | |
62 elseif strlen (self.Project_File) > 0 | |
63 let self.Project_File = browse (0, 'GNAT Project File?', '', self.Project_File) | |
64 elseif expand ("%:e") == 'gpr' | |
65 let self.Project_File = browse (0, 'GNAT Project File?', '', expand ("%:e")) | |
66 else | |
67 let self.Project_File = browse (0, 'GNAT Project File?', '', 'default.gpr') | |
68 endif | |
69 | |
70 if strlen (v:this_session) > 0 | |
71 execute 'mksession! ' . v:this_session | |
72 endif | |
73 | |
74 if strlen (self.Project_File) > 0 | |
75 call ada#Switch_Session ( | |
76 \ expand('~') . "/vimfiles/session/" . | |
77 \ fnamemodify (self.Project_File, ":t:r") . ".vim") | |
78 else | |
79 call ada#Switch_Session ('') | |
80 endif | |
81 | |
82 return | |
83 endfunction gnat#Set_Project_File " }}}1 | |
84 | |
85 function gnat#Get_Command (Command) dict " {{{1 | |
86 let l:Command = eval ('self.' . a:Command . '_Command') | |
87 return eval (l:Command) | |
88 endfunction gnat#Get_Command " }}}1 | |
89 | |
90 function gnat#Set_Session (...) dict " {{{1 | |
91 if argc() == 1 && fnamemodify (argv(0), ':e') == 'gpr' | |
92 call self.Set_Project_File (argv(0)) | |
93 elseif strlen (v:servername) > 0 | |
94 call self.Set_Project_File (v:servername . '.gpr') | |
95 endif | |
96 endfunction gnat#Set_Session " }}}1 | |
97 | |
98 function gnat#New () " {{{1 | |
99 let l:Retval = { | |
100 \ 'Make' : function ('gnat#Make'), | |
101 \ 'Pretty' : function ('gnat#Pretty'), | |
102 \ 'Find' : function ('gnat#Find'), | |
103 \ 'Tags' : function ('gnat#Tags'), | |
104 \ 'Set_Project_File' : function ('gnat#Set_Project_File'), | |
105 \ 'Set_Session' : function ('gnat#Set_Session'), | |
106 \ 'Get_Command' : function ('gnat#Get_Command'), | |
107 \ 'Project_File' : '', | |
108 \ 'Make_Command' : '"gnat make -P " . self.Project_File . " -F -gnatef "', | |
109 \ 'Pretty_Command' : '"gnat pretty -P " . self.Project_File . " "', | |
110 \ 'Find_Program' : '"gnat find -P " . self.Project_File . " -F "', | |
111 \ 'Tags_Command' : '"gnat xref -P " . self.Project_File . " -v *.AD*"', | |
112 \ 'Error_Format' : '%f:%l:%c: %trror: %m,' . | |
113 \ '%f:%l:%c: %tarning: %m,' . | |
114 \ '%f:%l:%c: (%ttyle) %m'} | |
115 | |
116 return l:Retval | |
117 endfunction gnat#New " }}}1 | |
118 | |
119 function gnat#Insert_Tags_Header () " {{{1 | |
120 1insert | |
121 !_TAG_FILE_FORMAT 1 /extended format; --format=1 will not append ;" to lines/ | |
122 !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ | |
123 !_TAG_PROGRAM_AUTHOR AdaCore /info@adacore.com/ | |
124 !_TAG_PROGRAM_NAME gnatxref // | |
125 !_TAG_PROGRAM_URL http://www.adacore.com /official site/ | |
126 !_TAG_PROGRAM_VERSION 5.05w // | |
127 . | |
128 return | |
129 endfunction gnat#Insert_Tags_Header " }}}1 | |
130 | |
131 finish " 1}}} | |
132 | |
133 "------------------------------------------------------------------------------ | |
134 " Copyright (C) 2006 Martin Krischik | |
135 " | |
136 " Vim is Charityware - see ":help license" or uganda.txt for licence details. | |
137 "------------------------------------------------------------------------------ | |
138 " vim: textwidth=0 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab | |
139 " vim: foldmethod=marker |