diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-15 20:25:09 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-15 20:25:09 +0000 |
commit | c6249bb24629c49cfc315ac540a21edf18a61eaf (patch) | |
tree | 815229a041a28df27396d1bbe8bfb418a2154928 | |
parent | 01a347a1bb78774a62dd8c251c75a7541b58cdb7 (diff) |
updated for version 7.0d05
-rw-r--r-- | runtime/autoload/rubycomplete.vim | 308 | ||||
-rw-r--r-- | runtime/colors/morning.vim | 4 | ||||
-rw-r--r-- | runtime/compiler/eruby.vim | 12 | ||||
-rw-r--r-- | runtime/compiler/ruby.vim | 13 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 49 | ||||
-rw-r--r-- | runtime/doc/tags | 4 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 6 | ||||
-rw-r--r-- | runtime/filetype.vim | 8 | ||||
-rw-r--r-- | runtime/ftplugin/eruby.vim | 12 | ||||
-rw-r--r-- | runtime/ftplugin/ruby.vim | 16 | ||||
-rw-r--r-- | runtime/indent/eruby.vim | 14 | ||||
-rw-r--r-- | runtime/synmenu.vim | 12 | ||||
-rw-r--r-- | runtime/syntax/doxygen.vim | 557 | ||||
-rw-r--r-- | runtime/syntax/eruby.vim | 12 | ||||
-rw-r--r-- | runtime/syntax/ruby.vim | 11 | ||||
-rw-r--r-- | runtime/syntax/smcl.vim | 308 | ||||
-rw-r--r-- | runtime/syntax/stata.vim | 449 | ||||
-rw-r--r-- | src/ex_getln.c | 4 | ||||
-rw-r--r-- | src/version.h | 6 |
19 files changed, 1737 insertions, 68 deletions
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim new file mode 100644 index 0000000000..8def228edc --- /dev/null +++ b/runtime/autoload/rubycomplete.vim @@ -0,0 +1,308 @@ +" Vim completion script +" Language: Ruby +" Maintainer: Mark Guzman ( segfault AT hasno DOT info ) +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" ---------------------------------------------------------------------------- +" +" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) +" ---------------------------------------------------------------------------- + +if !has('ruby') + echo "Error: Required vim compiled with +ruby" + finish +endif + +if version < 700 + echo "Error: Required vim >= 7.0" + finish +endif + +func! GetRubyVarType(v) + let stopline = 1 + let vtp = '' + let pos = getpos('.') + let [lnum,lcol] = searchpos('^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$','nb',stopline) + if lnum != 0 && lcol != 0 + call setpos('.',pos) + let str = getline(lnum) + let vtp = substitute(str,'^\s*#\s*@var\s*'.a:v.'\>\s\+\([^ \t]\+\)\s*$','\1','') + return vtp + endif + call setpos('.',pos) + let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)','nb',stopline) + if lnum != 0 && lcol != 0 + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)',lcol) + let str = substitute(str,'^=\s*','','') + call setpos('.',pos) + if str == '"' || str == '''' + return 'String' + elseif str == '[' + return 'Array' + elseif str == '{' + return 'Hash' + elseif strlen(str) > 4 + let l = stridx(str,'.') + return str[0:l-1] + end + return '' + endif + call setpos('.',pos) + return '' +endf + +function! rubycomplete#Complete(findstart, base) + "findstart = 1 when we need to get the text length + if a:findstart + let line = getline('.') + let idx = col('.') + while idx > 0 + let idx -= 1 + let c = line[idx-1] + if c =~ '\w' + continue + elseif ! c =~ '\.' + idx = -1 + break + else + break + endif + endwhile + + return idx + "findstart = 0 when we need to return the list of completions + else + execute "ruby get_completions('" . a:base . "')" + return g:rbcomplete_completions + endif +endfunction + + +function! s:DefRuby() +ruby << RUBYEOF +ReservedWords = [ + "BEGIN", "END", + "alias", "and", + "begin", "break", + "case", "class", + "def", "defined", "do", + "else", "elsif", "end", "ensure", + "false", "for", + "if", "in", + "module", + "next", "nil", "not", + "or", + "redo", "rescue", "retry", "return", + "self", "super", + "then", "true", + "undef", "unless", "until", + "when", "while", + "yield", + ] + +Operators = [ "%", "&", "*", "**", "+", "-", "/", + "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", + "[]", "[]=", "^", ] + +def identify_type(var) + @buf = VIM::Buffer.current + enum = @buf.line_number + snum = (enum-10).abs + nums = Range.new( snum, enum ) + regxs = '/.*(%s)\s*=(.*)/' % var + regx = Regexp.new( regxs ) + nums.each do |x| + ln = @buf[x] + #print $~ if regx.match( ln ) + end +end + +def load_requires + @buf = VIM::Buffer.current + enum = @buf.line_number + nums = Range.new( 1, enum ) + nums.each do |x| + ln = @buf[x] + begin + eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln ) + rescue Exception + #ignore? + end + end +end + +def get_completions(base) + load_requires + input = VIM::evaluate('expand("<cWORD>")') + input += base + message = nil + + + case input + when /^(\/[^\/]*\/)\.([^.]*)$/ + # Regexp + receiver = $1 + message = Regexp.quote($2) + + candidates = Regexp.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\]]*\])\.([^.]*)$/ + # Array + receiver = $1 + message = Regexp.quote($2) + + candidates = Array.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\}]*\})\.([^.]*)$/ + # Proc or Hash + receiver = $1 + message = Regexp.quote($2) + + candidates = Proc.instance_methods(true) | Hash.instance_methods(true) + select_message(receiver, message, candidates) + + when /^(:[^:.]*)$/ + # Symbol + if Symbol.respond_to?(:all_symbols) + sym = $1 + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates.grep(/^#{sym}/) + else + [] + end + + when /^::([A-Z][^:\.\(]*)$/ + # Absolute Constant or class methods + receiver = $1 + candidates = Object.constants + candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + + when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ + # Constant or class methods + receiver = $1 + message = Regexp.quote($4) + begin + candidates = eval("#{receiver}.constants | #{receiver}.methods") + rescue Exception + candidates = [] + end + candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} + + when /^(:[^:.]+)\.([^.]*)$/ + # Symbol + receiver = $1 + message = Regexp.quote($2) + + candidates = Symbol.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ + # Numeric + receiver = $1 + message = Regexp.quote($4) + + begin + candidates = eval(receiver).methods + rescue Exception + candidates + end + select_message(receiver, message, candidates) + + when /^(\$[^.]*)$/ + candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) + +# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ + when /^((\.?[^.]+)+)\.([^.]*)$/ + # variable + receiver = $1 + message = Regexp.quote($3) + + cv = eval("self.class.constants") + + vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) + if vartype != '' + candidates = eval("#{vartype}.instance_methods") + elsif (cv).include?(receiver) + # foo.func and foo is local var. + candidates = eval("#{receiver}.methods") + elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver + # Foo::Bar.func + begin + candidates = eval("#{receiver}.methods") + rescue Exception + candidates = [] + end + else + # func1.func2 + candidates = [] + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + candidates.concat m.instance_methods(false) + } + candidates.sort! + candidates.uniq! + end + #identify_type( receiver ) + select_message(receiver, message, candidates) + + #when /^((\.?[^.]+)+)\.([^.]*)\(\s*\)*$/ + #function call + #obj = $1 + #func = $3 + + when /^\.([^.]*)$/ + # unknown(maybe String) + + receiver = "" + message = Regexp.quote($1) + + candidates = String.instance_methods(true) + select_message(receiver, message, candidates) + + else + candidates = eval("self.class.constants") + + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + end + + #print candidates + if message != nil && message.length > 0 + rexp = '^%s' % message.downcase + candidates.delete_if do |c| + c.downcase.match( rexp ) + $~ == nil + end + end + + outp = "" + # tags = VIM::evaluate("taglist('^%s$')" % + (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } + outp.sub!(/,$/, '') + VIM::command("let g:rbcomplete_completions = [%s]" % outp) +end + + +def select_message(receiver, message, candidates) + candidates.grep(/^#{message}/).collect do |e| + case e + when /^[a-zA-Z_]/ + receiver + "." + e + when /^[0-9]/ + when *Operators + #receiver + " " + e + end + end + candidates.delete_if { |x| x == nil } + candidates.uniq! + candidates.sort! +end +RUBYEOF +endfunction + +call s:DefRuby() +" vim: set et ts=4: diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index 5b175877ff..f1ab841416 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -1,6 +1,6 @@ " Vim color file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Apr 14 +" Last Change: 2006 Apr 15 " This color scheme uses a light grey background. @@ -22,7 +22,7 @@ hi ModeMsg term=bold cterm=bold gui=bold hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold hi StatusLineNC term=reverse cterm=reverse gui=reverse hi VertSplit term=reverse cterm=reverse gui=reverse -hi Visual term=reverse ctermbg=grey guibg=grey90 +hi Visual term=reverse ctermbg=grey guibg=grey80 hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red hi Cursor guibg=Green guifg=NONE diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim index 474dafeece..b73ab61fd2 100644 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -1,10 +1,10 @@ " Vim compiler file -" Language: eRuby -" Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au> -" Info: $Id$ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" ---------------------------------------------------------------------------- +" Language: eRuby +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> if exists("current_compiler") finish diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim index d34b37e8f6..971621e8ca 100644 --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -1,10 +1,11 @@ " Vim compiler file -" Language: Ruby -" Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist <timh at rubyforge.org> -" Info: $Id$ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Language: Ruby +" Function: Syntax check and/or error reporting +" Maintainer: Tim Hammerquist <timh at rubyforge.org> +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " ---------------------------------------------------------------------------- " " Changelog: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b69fa3642d..f06866b610 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0d. Last change: 2006 Apr 14 +*eval.txt* For Vim version 7.0d. Last change: 2006 Apr 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1597,6 +1597,8 @@ getpos( {expr}) List position of cursor, mark, etc. getqflist() List list of quickfix items getreg( [{regname} [, 1]]) String contents of register getregtype( [{regname}]) String type of register +gettabwinvar( {tabnr}, {winnr}, {name}) + any {name} in {winnr} in tab page {tabnr} getwinposx() Number X coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window getwinvar( {nr}, {varname}) any variable {varname} in window {nr} @@ -1702,6 +1704,8 @@ setloclist( {nr}, {list}[, {action}]) setpos( {expr}, {list}) none set the {expr} position to {list} setqflist( {list}[, {action}]) Number modify quickfix list using {list} setreg( {n}, {v}[, {opt}]) Number set register to value and type +settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window + {winnr} in tab page {tabnr} to {val} setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} simplify( {filename}) String simplify filename as much as possible sort( {list} [, {func}]) List sort {list}, using {func} to compare @@ -2865,6 +2869,20 @@ getregtype([{regname}]) *getregtype()* <CTRL-V> is one character with value 0x16. If {regname} is not specified, |v:register| is used. +gettabwinvar({tabnr}, {winnr}, {varname}) *gettabwinvar()* + Get the value of an option or local window variable {varname} + in window {winnr} in tab page {tabnr}. + Tabs are numbered starting with one. For the current tabpage + use |getwinvar()|. + When {winnr} is zero the current window is used. + This also works for a global option, buffer-local option and + window-local option, but it doesn't work for a global variable + or buffer-local variable. + Note that the name without "w:" must be used. + Examples: > + :let list_is_on = gettabwinvar(1, 2, '&list') + :echo "myvar = " . gettabwinvar(3, 1, 'myvar') + *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be @@ -2875,14 +2893,8 @@ getwinposy() The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. -getwinvar({nr}, {varname}) *getwinvar()* - The result is the value of option or local window variable - {varname} in window {nr}. When {nr} is zero the current - window is used. - This also works for a global option, buffer-local option and - window-local option, but it doesn't work for a global variable - or buffer-local variable. - Note that the name without "w:" must be used. +getwinvar({winnr}, {varname}) *getwinvar()* + Like |gettabwinvar()| for the current tabpage. Examples: > :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') @@ -4359,17 +4371,28 @@ setreg({regname}, {value} [,{options}]) nothing: > :call setreg('a', '', 'al') -setwinvar({nr}, {varname}, {val}) *setwinvar()* - Set option or local variable {varname} in window {nr} to - {val}. When {nr} is zero the current window is used. +settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* + Set option or local variable {varname} in window {winnr} to + {val}. + Tabs are numbered starting with one. For the current tabpage + use |setwinvar()|. + When {winnr} is zero the current window is used. This also works for a global or local buffer option, but it doesn't work for a global or local buffer variable. For a local buffer option the global value is unchanged. Note that the variable name without "w:" must be used. + Vim briefly goes to the tab page {tabnr}, this may trigger + TabLeave and TabEnter autocommands. + Examples: > + :call settabwinvar(1, 1, "&list", 0) + :call settabwinvar(3, 2, "myvar", "foobar") +< This function is not available in the |sandbox|. + +setwinvar({nr}, {varname}, {val}) *setwinvar()* + Like |settabwinvar()| for the current tab page. Examples: > :call setwinvar(1, "&list", 0) :call setwinvar(2, "myvar", "foobar") -< This function is not available in the |sandbox|. simplify({filename}) *simplify()* Simplify the file name as much as possible without changing diff --git a/runtime/doc/tags b/runtime/doc/tags index 5acac75b21..3ee117eb87 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4976,6 +4976,8 @@ dos32 os_msdos.txt /*dos32* dosbatch.vim syntax.txt /*dosbatch.vim* double-click term.txt /*double-click* download intro.txt /*download* +doxygen-syntax syntax.txt /*doxygen-syntax* +doxygen.vim syntax.txt /*doxygen.vim* dp diff.txt /*dp* drag-n-drop gui.txt /*drag-n-drop* drag-n-drop-win32 gui_w32.txt /*drag-n-drop-win32* @@ -5482,6 +5484,7 @@ getreg() eval.txt /*getreg()* getregtype() eval.txt /*getregtype()* getscript getscript.txt /*getscript* getscript.txt getscript.txt /*getscript.txt* +gettabwinvar() eval.txt /*gettabwinvar()* getwinposx() eval.txt /*getwinposx()* getwinposy() eval.txt /*getwinposy()* getwinvar() eval.txt /*getwinvar()* @@ -6788,6 +6791,7 @@ setloclist() eval.txt /*setloclist()* setpos() eval.txt /*setpos()* setqflist() eval.txt /*setqflist()* setreg() eval.txt /*setreg()* +settabwinvar() eval.txt /*settabwinvar()* setting-guifont gui.txt /*setting-guifont* setting-guitablabel tabpage.txt /*setting-guitablabel* setting-tabline tabpage.txt /*setting-tabline* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 38e0621b0b..9663373297 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.0d. Last change: 2006 Apr 09 +*usr_41.txt* For Vim version 7.0d. Last change: 2006 Apr 15 VIM USER MANUAL - by Bram Moolenaar @@ -652,8 +652,10 @@ Variables: function() get a Funcref for a function name getbufvar() get a variable value from a specific buffer setbufvar() set a variable in a specific buffer - getwinvar() get a variable value from a specific window + getwinvar() get a variable from specific window + gettabwinvar() get a variable from specific window & tab page setwinvar() set a variable in a specific window + settabwinvar() set a variable in a specific window & tab page garbagecollect() possibly free memory Cursor and mark position: diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e84573a312..26463a8be3 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Apr 12 +" Last Change: 2006 Apr 15 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1653,6 +1653,12 @@ au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig " OpenSSH server configuration au BufNewFile,BufRead sshd_config setf sshdconfig +" Stata +au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata + +" SMCL +au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl + " Stored Procedures au BufNewFile,BufRead *.stp setf stp diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index d256831bf3..6d8b4eafd3 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -1,10 +1,10 @@ " Vim filetype plugin -" Language: eRuby -" Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au> -" Info: $Id$ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" ---------------------------------------------------------------------------- +" Language: eRuby +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 8ce7f12ac3..40d1c5540b 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -1,9 +1,10 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair <gsinclair at soyabean.com.au> -" Info: $Id$ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Language: Ruby +" Maintainer: Gavin Sinclair <gsinclair at soyabean.com.au> +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " ---------------------------------------------------------------------------- " " Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at @@ -51,7 +52,10 @@ setlocal formatoptions-=t formatoptions+=croql setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal suffixesadd=.rb -setlocal omnifunc=rubycomplete#Complete + +if version >= 700 + setlocal omnifunc=rubycomplete#Complete +endif " TODO: "setlocal define=^\\s*def diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index b62a0245f2..ab950b6599 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -1,10 +1,10 @@ " Vim indent file -" Language: Ruby -" Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au> -" Info: $Id$ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" ---------------------------------------------------------------------------- +" Language: Ruby +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -12,3 +12,5 @@ if exists("b:did_indent") endif runtime! indent/html.vim + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 1bda521002..d9da7cc410 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -420,11 +420,13 @@ an 50.100.520 &Syntax.Sh-S.SQR :cal SetSyn("sqr")<CR> an 50.100.530 &Syntax.Sh-S.Ssh.ssh_config :cal SetSyn("sshconfig")<CR> an 50.100.540 &Syntax.Sh-S.Ssh.sshd_config :cal SetSyn("sshdconfig")<CR> an 50.100.550 &Syntax.Sh-S.Standard\ ML :cal SetSyn("sml")<CR> -an 50.100.560 &Syntax.Sh-S.Stored\ Procedures :cal SetSyn("stp")<CR> -an 50.100.570 &Syntax.Sh-S.Strace :cal SetSyn("strace")<CR> -an 50.100.580 &Syntax.Sh-S.Subversion\ commit :cal SetSyn("svn")<CR> -an 50.100.590 &Syntax.Sh-S.Sudoers :cal SetSyn("sudoers")<CR> -an 50.100.600 &Syntax.Sh-S.Sysctl\.conf :cal SetSyn("sysctl")<CR> +an 50.100.560 &Syntax.Sh-S.Stata.SMCL :cal SetSyn("smcl")<CR> +an 50.100.570 &Syntax.Sh-S.Stata.Stata :cal SetSyn("stata")<CR> +an 50.100.580 &Syntax.Sh-S.Stored\ Procedures :cal SetSyn("stp")<CR> +an 50.100.590 &Syntax.Sh-S.Strace :cal SetSyn("strace")<CR> +an 50.100.600 &Syntax.Sh-S.Subversion\ commit :cal SetSyn("svn")<CR> +an 50.100.610 &Syntax.Sh-S.Sudoers :cal SetSyn("sudoers")<CR> +an 50.100.620 &Syntax.Sh-S.Sysctl\.conf :cal SetSyn("sysctl")<CR> an 50.110.100 &Syntax.TUV.TADS :cal SetSyn("tads")<CR> an 50.110.110 &Syntax.TUV.Tags :cal SetSyn("tags")<CR> an 50.110.120 &Syntax.TUV.TAK.TAK\ compare :cal SetSyn("takcmp")<CR> diff --git a/runtime/syntax/doxygen.vim b/runtime/syntax/doxygen.vim new file mode 100644 index 0000000000..c77b89eb9e --- /dev/null +++ b/runtime/syntax/doxygen.vim @@ -0,0 +1,557 @@ +" DoxyGen syntax hilighting extension for c/c++/idl/java +" Language: doxygen on top of c, cpp, idl, java +" Maintainer: Michael Geddes <michaelrgeddes@optushome.com.au> +" Author: Michael Geddes +" Last Change: 12 December 2005 +" Version: 1.15 +" +" Copyright 2004 Michael Geddes +" Please feel free to use, modify & distribute all or part of this script, +" providing this copyright message remains. +" I would appreciate being acknowledged in any derived scripts, and would +" appreciate and welcome any updates, modifications or suggestions. + +" NOTE: Comments welcome! +" +" There are two variables that control the syntax hilighting produced by this +" script: +" doxygen_enhanced_colour - Use the (non-standard) original colours designed for this hilighting. +" doxygen_my_rendering - Disable the HTML bold/italic/underline rendering. +" +" A brief description without '.' or '!' will cause the end comment +" character to be marked as an error. You can define the colour of this using +" the highlight doxygenErrorComment. +" A \link without an \endlink will cause an error hilight on the end-comment. +" This is defined by doxygenLinkError +" +" The variable g:doxygen_codeword_font can be set to the guifont for marking \c +" words - a 'typewriter' like font normally. Spaces must be escaped. It can +" also be set to any hilight attribute. Alternatively, a hilight for doxygenCodeWord +" can be used to override it. +" +" By default, hilighting is done assumng you have the JAVADOC_AUTOBRIEF +" setting tunred on in your Doxygen configuration. If you don't, you +" can set the variable g:doxygen_javadoc_autobrief to 0 to have the +" hilighting more accurately reflect the way Doxygen will interpret your +" comments. +" +" Special thanks to: Wu Yongwei, Toby Allsopp +" + +if exists('b:suppress_doxygen') + unlet b:suppress_doxygen + finish +endif + +if exists('b:current_syntax') && b:current_syntax =~ 'doxygen' && !exists('doxygen_debug_script') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Start of Doxygen syntax hilighting: +" + +" C/C++ Style line comments +syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend +syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenStartL keepend skipwhite skipnl nextgroup=doxygenComment2 +syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL keepend skipwhite skipnl +syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial + +" Single line brief followed by multiline comment. +syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend +" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. +syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl + +" Skip empty lines at the start for when comments start on the 2nd/3rd line. +syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkip skipwhite skipnl +syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,,doxygenStartSkip skipwhite skipnl +syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl + +" Match the Starting pattern (effectively creating the start of a BNF) +if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief + syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl +else + syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl +endif +syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial skipwhite + +" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. +syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl + +" Match the first sentence as a brief comment +if ! exists('g:doxygen_end_punctuation') + let g:doxygen_end_punctuation='[.]' +endif +exe 'syn region doxygenBrief contained start=+[\\@]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueComment,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenOtherLink,doxygenHyperLink,doxygenHashLink skipnl nextgroup=doxygenBody' + +syn match doxygenBriefEndComment +\*/+ contained + +exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup keepend' + +syn region doxygenBriefLine contained start=+\<\k+ end=+\(\n\s*\*\=\s*\([@\\]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ contains=doxygenContinueComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenOtherLink,doxygenHyperLink,doxygenHashLink skipwhite keepend + +" Match a '<' for applying a comment to the previous element. +syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenSpecial,doxygenStartSkip skipwhite +syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite + +" These are anti-doxygen comments. If there are more than two asterisks or 3 '/'s +" then turn the comments back into normal C comments. +syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cCommentString,cCharacter,cNumbersCom,cSpaceError +syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError + +" Special commands at the start of the area: starting with '@' or '\' +syn region doxygenStartSpecial contained start=+[@\\]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=doxygenSpecial nextgroup=doxygenSkipComment skipnl keepend +syn match doxygenSkipComment contained +^\s*\*/\@!+ nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenPage skipwhite + +"syn region doxygenBodyBit contained start=+$+ + +" The main body of a doxygen comment. +syn region doxygenBody contained start=+.\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueComment,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup + +" These allow the skipping of comment continuation '*' characters. +syn match doxygenContinueComment contained +^\s*\*/\@!\s*+ + +" Catch a Brief comment without punctuation - flag it as an error but +" make sure the end comment is picked up also. +syn match doxygenErrorComment contained +\*/+ + + +" Skip empty lines at the start for when comments start on the 2nd/3rd line. +if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief + syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl + syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl +else + syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl + syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl +endif + +" Match an [@\]brief so that it moves to body-mode. +" +" +" syn match doxygenBriefLine contained +syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite +syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([pcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained + + +" Create the single word matching special identifiers. + +fun! s:DxyCreateSmallSpecial( kword, name ) + + let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@< |