summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-01-06 20:54:52 +0100
committerBram Moolenaar <Bram@vim.org>2010-01-06 20:54:52 +0100
commit5c73622a9066182ee4479fd7b3aa86e1825808c3 (patch)
treec92ed672cbb989fa3585387ebd4598f5bdfcc637 /runtime/syntax
parent8f3f58f2c361f1b7241128d9821f88d8a30aa066 (diff)
Update runtime files.
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/2html.vim424
-rw-r--r--runtime/syntax/ada.vim8
-rw-r--r--runtime/syntax/ant.vim2
-rw-r--r--runtime/syntax/aspvbs.vim2
-rw-r--r--runtime/syntax/bindzone.vim2
-rw-r--r--runtime/syntax/bst.vim2
-rw-r--r--runtime/syntax/bzr.vim20
-rw-r--r--runtime/syntax/c.vim14
-rw-r--r--runtime/syntax/catalog.vim2
-rw-r--r--runtime/syntax/cl.vim2
-rw-r--r--runtime/syntax/cmake.vim10
-rw-r--r--runtime/syntax/cobol.vim2
-rw-r--r--runtime/syntax/config.vim4
-rw-r--r--runtime/syntax/cs.vim10
-rw-r--r--runtime/syntax/debchangelog.vim6
-rw-r--r--runtime/syntax/debcontrol.vim24
-rw-r--r--runtime/syntax/debsources.vim6
-rw-r--r--runtime/syntax/def.vim4
-rw-r--r--runtime/syntax/django.vim13
-rw-r--r--runtime/syntax/docbk.vim4
-rw-r--r--runtime/syntax/dosbatch.vim22
-rw-r--r--runtime/syntax/doxygen.vim6
-rw-r--r--runtime/syntax/dsl.vim2
-rw-r--r--runtime/syntax/elf.vim2
-rw-r--r--runtime/syntax/erlang.vim4
-rw-r--r--runtime/syntax/eruby.vim2
-rw-r--r--runtime/syntax/focexec.vim4
-rw-r--r--runtime/syntax/form.vim87
-rw-r--r--runtime/syntax/forth.vim2
-rw-r--r--runtime/syntax/fortran.vim4
-rw-r--r--runtime/syntax/fstab.vim26
-rw-r--r--runtime/syntax/gdb.vim4
-rw-r--r--runtime/syntax/git.vim29
-rw-r--r--runtime/syntax/gitcommit.vim30
-rw-r--r--runtime/syntax/gitconfig.vim4
-rw-r--r--runtime/syntax/gitrebase.vim8
-rw-r--r--runtime/syntax/groovy.vim1
-rw-r--r--runtime/syntax/haskell.vim5
-rw-r--r--runtime/syntax/help.vim4
-rw-r--r--runtime/syntax/hog.vim2
-rw-r--r--runtime/syntax/initng.vim2
-rw-r--r--runtime/syntax/java.vim19
-rw-r--r--runtime/syntax/kconfig.vim6
-rw-r--r--runtime/syntax/kscript.vim2
-rw-r--r--runtime/syntax/lex.vim67
-rw-r--r--runtime/syntax/lhaskell.vim21
-rw-r--r--runtime/syntax/lilo.vim10
-rw-r--r--runtime/syntax/lisp.vim7
-rw-r--r--runtime/syntax/logtalk.vim8
-rw-r--r--runtime/syntax/lout.vim2
-rw-r--r--runtime/syntax/mail.vim42
-rw-r--r--runtime/syntax/man.vim4
-rw-r--r--runtime/syntax/masm.vim4
-rw-r--r--runtime/syntax/master.vim4
-rw-r--r--runtime/syntax/matlab.vim33
-rw-r--r--runtime/syntax/maxima.vim2
-rw-r--r--runtime/syntax/mgl.vim2
-rw-r--r--runtime/syntax/mma.vim2
-rw-r--r--runtime/syntax/mysql.vim6
-rw-r--r--runtime/syntax/ncf.vim2
-rw-r--r--runtime/syntax/netrc.vim21
-rw-r--r--runtime/syntax/netrw.vim128
-rw-r--r--runtime/syntax/opl.vim2
-rw-r--r--runtime/syntax/papp.vim3
-rw-r--r--runtime/syntax/po.vim4
-rw-r--r--runtime/syntax/progress.vim2
-rw-r--r--runtime/syntax/prolog.vim6
-rw-r--r--runtime/syntax/pyrex.vim12
-rw-r--r--runtime/syntax/python.vim342
-rw-r--r--runtime/syntax/rcs.vim2
-rw-r--r--runtime/syntax/readline.vim3
-rw-r--r--runtime/syntax/remind.vim26
-rw-r--r--runtime/syntax/rhelp.vim9
-rw-r--r--runtime/syntax/rnoweb.vim7
-rw-r--r--runtime/syntax/rst.vim13
-rw-r--r--runtime/syntax/ruby.vim2
-rw-r--r--runtime/syntax/samba.vim8
-rw-r--r--runtime/syntax/scheme.vim87
-rw-r--r--runtime/syntax/sdc.vim41
-rw-r--r--runtime/syntax/sgml.vim2
-rw-r--r--runtime/syntax/sgmllnx.vim4
-rw-r--r--runtime/syntax/sh.vim70
-rw-r--r--runtime/syntax/sisu.vim6
-rw-r--r--runtime/syntax/spec.vim3
-rw-r--r--runtime/syntax/splint.vim4
-rw-r--r--runtime/syntax/spyce.vim3
-rw-r--r--runtime/syntax/sqlanywhere.vim285
-rw-r--r--runtime/syntax/sshconfig.vim111
-rw-r--r--runtime/syntax/sshdconfig.vim115
-rw-r--r--runtime/syntax/svn.vim2
-rw-r--r--runtime/syntax/tads.vim4
-rw-r--r--runtime/syntax/taskdata.vim43
-rw-r--r--runtime/syntax/taskedit.vim35
-rw-r--r--runtime/syntax/tcl.vim99
-rw-r--r--runtime/syntax/tcsh.vim12
-rw-r--r--runtime/syntax/tex.vim33
-rw-r--r--runtime/syntax/tilde.vim2
-rw-r--r--runtime/syntax/uil.vim5
-rw-r--r--runtime/syntax/updatedb.vim8
-rw-r--r--runtime/syntax/vhdl.vim2
-rw-r--r--runtime/syntax/vim.vim636
-rw-r--r--runtime/syntax/xdefaults.vim2
-rw-r--r--runtime/syntax/xml.vim10
-rw-r--r--runtime/syntax/xquery.vim2
-rw-r--r--runtime/syntax/xsd.vim2
-rw-r--r--runtime/syntax/xslt.vim2
-rw-r--r--runtime/syntax/yacc.vim122
107 files changed, 2145 insertions, 1251 deletions
diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim
index ee66bf644d..252a841f20 100644
--- a/runtime/syntax/2html.vim
+++ b/runtime/syntax/2html.vim
@@ -1,13 +1,18 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2008 Jul 17
+" Last Change: 2009 Jul 14
" (modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>)
" (XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>)
" (made w3 compliant by Edd Barrett <vext01@gmail.com>)
" (added html_font. Edd Barrett <vext01@gmail.com>)
+" (dynamic folding by Ben Fritz <fritzophrenic@gmail.com>)
" Transform a file into HTML, using the current syntax highlighting.
+" this file uses line continuations
+let s:cpo_sav = &cpo
+set cpo-=C
+
" Number lines when explicitely requested or when `number' is set
if exists("html_number_lines")
let s:numblines = html_number_lines
@@ -22,6 +27,37 @@ else
let s:htmlfont = "monospace"
endif
+" make copies of the user-defined settings that we may overrule
+if exists("html_dynamic_folds")
+ let s:html_dynamic_folds = 1
+endif
+if exists("html_hover_unfold")
+ let s:html_hover_unfold = 1
+endif
+if exists("html_use_css")
+ let s:html_use_css = 1
+endif
+
+" hover opening implies dynamic folding
+if exists("s:html_hover_unfold")
+ let s:html_dynamic_folds = 1
+endif
+
+" dynamic folding with no foldcolumn implies hover opens
+if exists("s:html_dynamic_folds") && exists("html_no_foldcolumn")
+ let s:html_hover_unfold = 1
+endif
+
+" ignore folding overrides dynamic folding
+if exists("html_ignore_folding") && exists("s:html_dynamic_folds")
+ unlet s:html_dynamic_folds
+endif
+
+" dynamic folding implies css
+if exists("s:html_dynamic_folds")
+ let s:html_use_css = 1
+endif
+
" When not in gui we can only guess the colors.
if has("gui_running")
let s:whatterm = "gui"
@@ -62,7 +98,7 @@ else
endfun
endif
-if !exists("html_use_css")
+if !exists("s:html_use_css")
" Return opening HTML tag for given highlight id
function! s:HtmlOpening(id)
let a = ""
@@ -150,6 +186,26 @@ function! s:CSS1(id)
return a
endfun
+if exists("s:html_dynamic_folds")
+
+ " compares two folds as stored in our list of folds
+ " A fold is "less" than another if it starts at an earlier line number,
+ " or ends at a later line number, ties broken by fold level
+ function! s:FoldCompare(f1, f2)
+ if a:f1.firstline != a:f2.firstline
+ " put it before if it starts earlier
+ return a:f1.firstline - a:f2.firstline
+ elseif a:f1.lastline != a:f2.lastline
+ " put it before if it ends later
+ return a:f2.lastline - a:f1.lastline
+ else
+ " if folds begin and end on the same lines, put lowest fold level first
+ return a:f1.level - a:f2.level
+ endif
+ endfunction
+
+endif
+
" Figure out proper MIME charset from the 'encoding' option.
if exists("html_use_encoding")
let s:html_encoding = html_use_encoding
@@ -223,13 +279,13 @@ else
let s:tag_close = '>'
endif
-" Cache html_no_pre incase we have to turn it on for non-css mode
+" Cache html_no_pre in case we have to turn it on for non-css mode
if exists("html_no_pre")
let s:old_html_no_pre = html_no_pre
endif
-if !exists("html_use_css")
- " Cant put font tags in <pre>
+if !exists("s:html_use_css")
+ " Can't put font tags in <pre>
let html_no_pre=1
endif
@@ -251,9 +307,86 @@ if s:html_encoding != ""
exe "normal! a<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:html_encoding . '"' . s:tag_close . "\n\e"
endif
-if exists("html_use_css")
- exe "normal! a<style type=\"text/css\">\n<!--\n-->\n</style>\n\e"
+if exists("s:html_use_css")
+ if exists("s:html_dynamic_folds")
+ if exists("s:html_hover_unfold")
+ " if we are doing hover_unfold, use css 2 with css 1 fallback for IE6
+ exe "normal! a".
+ \ "<style type=\"text/css\">\n<!--\n".
+ \ ".FoldColumn { text-decoration: none; white-space: pre; }\n\n".
+ \ "body * { margin: 0; padding: 0; }\n".
+ \ "\n".
+ \ ".open-fold > .Folded { display: none; }\n".
+ \ ".open-fold > .fulltext { display: inline; }\n".
+ \ ".closed-fold > .fulltext { display: none; }\n".
+ \ ".closed-fold > .Folded { display: inline; }\n".
+ \ "\n".
+ \ ".open-fold > .toggle-open { display: none; }\n".
+ \ ".open-fold > .toggle-closed { display: inline; }\n".
+ \ ".closed-fold > .toggle-open { display: inline; }\n".
+ \ ".closed-fold > .toggle-closed { display: none; }\n"
+ exe "normal! a\n/* opening a fold while hovering won't be supported by IE6 and other\n".
+ \ "similar browsers, but it should fail gracefully. */\n".
+ \ ".closed-fold:hover > .fulltext { display: inline; }\n".
+ \ ".closed-fold:hover > .toggle-filler { display: none; }\n".
+ \ ".closed-fold:hover > .Folded { display: none; }\n"
+ exe "normal! a-->\n</style>\n"
+ exe "normal! a<!--[if lt IE 7]>".
+ \ "<style type=\"text/css\">\n".
+ \ ".open-fold .Folded { display: none; }\n".
+ \ ".open-fold .fulltext { display: inline; }\n".
+ \ ".open-fold .toggle-open { display: none; }\n".
+ \ ".closed-fold .toggle-closed { display: inline; }\n".
+ \ "\n".
+ \ ".closed-fold .fulltext { display: none; }\n".
+ \ ".closed-fold .Folded { display: inline; }\n".
+ \ ".closed-fold .toggle-open { display: inline; }\n".
+ \ ".closed-fold .toggle-closed { display: none; }\n".
+ \ "</style>\n".
+ \ "<![endif]-->\n"
+ else
+ " if we aren't doing hover_unfold, use CSS 1 only
+ exe "normal! a<style type=\"text/css\">\n<!--\n".
+ \ ".FoldColumn { text-decoration: none; white-space: pre; }\n\n".
+ \ ".open-fold .Folded { display: none; }\n".
+ \ ".open-fold .fulltext { display: inline; }\n".
+ \ ".open-fold .toggle-open { display: none; }\n".
+ \ ".closed-fold .toggle-closed { display: inline; }\n".
+ \ "\n".
+ \ ".closed-fold .fulltext { display: none; }\n".
+ \ ".closed-fold .Folded { display: inline; }\n".
+ \ ".closed-fold .toggle-open { display: inline; }\n".
+ \ ".closed-fold .toggle-closed { display: none; }\n".
+ \ "-->\n</style>\n"
+ endif
+ else
+ " if we aren't doing any dynamic folding, no need for any special rules
+ exe "normal! a<style type=\"text/css\">\n<!--\n-->\n</style>\n\e"
+ endif
+endif
+
+" insert javascript to toggle folds open and closed
+if exists("s:html_dynamic_folds")
+ exe "normal! a\n".
+ \ "<script type='text/javascript'>\n".
+ \ "<!--\n".
+ \ "function toggleFold(objID)\n".
+ \ "{\n".
+ \ " var fold;\n".
+ \ " fold = document.getElementById(objID);\n".
+ \ " if(fold.className == 'closed-fold')\n".
+ \ " {\n".
+ \ " fold.className = 'open-fold';\n".
+ \ " }\n".
+ \ " else if (fold.className == 'open-fold')\n".
+ \ " {\n".
+ \ " fold.className = 'closed-fold';\n".
+ \ " }\n".
+ \ "}\n".
+ \ "-->\n".
+ \ "</script>\n\e"
endif
+
if exists("html_no_pre")
exe "normal! a</head>\n<body>\n\e"
else
@@ -265,7 +398,81 @@ exe s:orgwin . "wincmd w"
" List of all id's
let s:idlist = ","
-" Loop over all lines in the original text.
+" First do some preprocessing for dynamic folding. Do this for the entire file
+" so we don't accidentally start within a closed fold or something.
+let s:allfolds = []
+
+if exists("s:html_dynamic_folds")
+ let s:lnum = 1
+ let s:end = line('$')
+ " save the fold text and set it to the default so we can find fold levels
+ let s:foldtext_save = &foldtext
+ set foldtext&
+
+ " we will set the foldcolumn in the html to the greater of the maximum fold
+ " level and the current foldcolumn setting
+ let s:foldcolumn = &foldcolumn
+
+ " get all info needed to describe currently closed folds
+ while s:lnum < s:end
+ if foldclosed(s:lnum) == s:lnum
+ " default fold text has '+-' and then a number of dashes equal to fold
+ " level, so subtract 2 from index of first non-dash after the dashes
+ " in order to get the fold level of the current fold
+ let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
+ if s:level+1 > s:foldcolumn
+ let s:foldcolumn = s:level+1
+ endif
+ " store fold info for later use
+ let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
+ call add(s:allfolds, s:newfold)
+ " open the fold so we can find any contained folds
+ execute s:lnum."foldopen"
+ else
+ let s:lnum = s:lnum + 1
+ endif
+ endwhile