diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-06-13 20:20:40 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-06-13 20:20:40 +0000 |
commit | 071d4279d6ab81b7187b48f3a0fc61e587b6db6c (patch) | |
tree | 221cbe3c40e043163c06f61c52a7ba2eb41e12ce /runtime/ftplugin | |
parent | b4210b3bc14e2918f153a7307530fbe6eba659e1 (diff) |
updated for version 7.0001v7.0001
Diffstat (limited to 'runtime/ftplugin')
63 files changed, 3140 insertions, 0 deletions
diff --git a/runtime/ftplugin/README.txt b/runtime/ftplugin/README.txt new file mode 100644 index 0000000000..19ad58bdd3 --- /dev/null +++ b/runtime/ftplugin/README.txt @@ -0,0 +1,24 @@ +The ftplugin directory is for Vim plugin scripts that are only used for a +specific filetype. + +All files ending in .vim in this directory and subdirectories will be sourced +by Vim when it detects the filetype that matches the name of the file or +subdirectory. +For example, these are all loaded for the "c" filetype: + + c.vim + c_extra.vim + c/settings.vim + +Note that the "_" in "c_extra.vim" is required to separate the filetype name +from the following arbitrary name. + +The filetype plugins are only loaded when the ":filetype plugin" command has +been used. + +The default filetype plugin files contain settings that 95% of the users will +want to use. They do not contain personal preferences, like the value of +'shiftwidth'. + +If you want to do additional settings, or overrule the default filetype +plugin, you can create your own plugin file. See ":help ftplugin" in Vim. diff --git a/runtime/ftplugin/aap.vim b/runtime/ftplugin/aap.vim new file mode 100644 index 0000000000..90d404fa66 --- /dev/null +++ b/runtime/ftplugin/aap.vim @@ -0,0 +1,25 @@ +" Vim filetype plugin file +" Language: Aap recipe +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2003 Nov 04 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +" Reset 'formatoptions', 'comments' and 'expandtab' to undo this plugin. +let b:undo_ftplugin = "setl fo< com< et<" + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format dashed lists in comments. +setlocal comments=s:#\ -,m:#\ \,e:#,n:#,fb:- + +" Expand tabs to spaces to avoid trouble. +setlocal expandtab diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim new file mode 100644 index 0000000000..f63962f815 --- /dev/null +++ b/runtime/ftplugin/abaqus.vim @@ -0,0 +1,75 @@ +" Vim filetype plugin file +" Language: Abaqus finite element input file (www.abaqus.com) +" Maintainer: Carl Osterwisch <osterwischc@asme.org> +" Last Change: 2004 May + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") | finish | endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +" Save the compatibility options and temporarily switch to vim defaults +let s:cpo_save = &cpoptions +set cpoptions&vim + +" Folding +if version >= 600 + " Fold all lines that do not begin with * + setlocal foldexpr=getline(v:lnum)[0]!=\"\*\" + setlocal foldmethod=expr +endif + +" Set the format of the include file specification for Abaqus +" Used in :check gf ^wf [i and other commands +setlocal include=\\<\\cINPUT\\s*= + +" Remove characters up to the first = when evaluating filenames +setlocal includeexpr=substitute(v:fname,'.\\{-}=','','') + +" Define format of comment lines (see 'formatoptions' for uses) +setlocal comments=:** +setlocal commentstring=**%s + +" Definitions start with a * and assign a NAME, NSET, or ELSET +" Used in [d ^wd and other commands +setlocal define=^\\*\\a.*\\c\\(NAME\\\|NSET\\\|ELSET\\)\\s*= + +" Abaqus keywords and identifiers may include a - character +setlocal iskeyword+=- + +" Set the file browse filter (currently only supported under Win32 gui) +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . + \ "Abaqus Results (*.dat)\t*.dat\n" . + \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Define keys used to move [count] sections backward or forward. +" TODO: Make this do something intelligent in visual mode. +nnoremap <silent> <buffer> [[ :call <SID>Abaqus_Jump('?^\*\a?')<CR> +nnoremap <silent> <buffer> ]] :call <SID>Abaqus_Jump('/^\*\a/')<CR> +function! <SID>Abaqus_Jump(motion) range + let s:count = v:count1 + mark ' + while s:count > 0 + silent! execute a:motion + let s:count = s:count - 1 + endwhile +endfunction + +" Define key to toggle commenting of the current line or range +noremap <silent> <buffer> <m-c> :call <SID>Abaqus_ToggleComment()<CR>j +function! <SID>Abaqus_ToggleComment() range + if strpart(getline(a:firstline), 0, 2) == "**" + " Un-comment all lines in range + silent execute a:firstline . ',' . a:lastline . 's/^\*\*//' + else + " Comment all lines in range + silent execute a:firstline . ',' . a:lastline . 's/^/**/' + endif +endfunction + +" Restore saved compatibility options +let &cpoptions = s:cpo_save diff --git a/runtime/ftplugin/ada.vim b/runtime/ftplugin/ada.vim new file mode 100644 index 0000000000..06c057fc83 --- /dev/null +++ b/runtime/ftplugin/ada.vim @@ -0,0 +1,226 @@ +" Vim Ada plugin file +" Language: Ada +" Maintainer: Neil Bird <neil@fnxweb.com> +" Last Change: 2003 May 11 +" Version: $Id$ +" Look for the latest version at http://vim.sourceforge.net/ +" +" Perform Ada specific completion & tagging. +" +" +" Provides mapping overrides for tag jumping that figure out the current +" Ada object and tag jump to that, not the 'simple' vim word. +" Similarly allows <Ctrl-N> matching of full-length ada entities from tags. +" Exports 'AdaWord()' function to return full name of Ada entity under the +" cursor( or at given line/column), stripping whitespace/newlines as necessary. + + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +" Temporarily set cpoptions to ensure the script loads OK +let s:cpoptions = &cpoptions +set cpo-=C + + +" Ada comments +setlocal comments+=O:-- + + +" Make local tag mappings for this buffer (if not already set) +if mapcheck('<C-]>','n') == '' + nnoremap <unique> <buffer> <C-]> :call JumpToTag_ada('')<cr> +endif +if mapcheck('g<C-]>','n') == '' + nnoremap <unique> <buffer> g<C-]> :call JumpToTag_ada('','stj')<cr> +endif + +if mapcheck('<C-N>','i') == '' + inoremap <unique> <buffer> <C-N> <C-R>=<SID>AdaCompletion("\<lt>C-N>")<cr> +endif +if mapcheck('<C-P>','i') == '' + inoremap <unique> <buffer> <C-P> <C-R>=<SID>AdaCompletion("\<lt>C-P>")<cr> +endif +if mapcheck('<C-X><C-]>','i') == '' + inoremap <unique> <buffer> <C-X><C-]> <C-R>=<SID>AdaCompletion("\<lt>C-X>\<lt>C-]>")<cr> +endif +if mapcheck('<bs>','i') == '' + inoremap <silent> <unique> <buffer> <bs> <C-R>=<SID>AdaInsertBackspace()<cr> +endif + + +" Only do this when not done yet for this buffer & matchit is used +if ! exists("b:match_words") && exists("loaded_matchit") + " The following lines enable the macros/matchit.vim plugin for + " Ada-specific extended matching with the % key. + let s:notend = '\%(\<end\s\+\)\@<!' + let b:match_words= + \ s:notend . '\<if\>:\<elsif\>:\<else\>:\<end\>\s\+\<if\>,' . + \ s:notend . '\<case\>:\<when\>:\<end\>\s\+\<case\>,' . + \ '\%(\<while\>.*\|\<for\>.*\|'.s:notend.'\)\<loop\>:\<end\>\s\+\<loop\>,' . + \ '\%(\<do\>\|\<begin\>\):\<exception\>:\<end\>\s*\%($\|[;A-Z]\),' . + \ s:notend . '\<record\>:\<end\>\s\+\<record\>' +endif + + +" Prevent re-load of functions +if exists('s:id') + finish +endif + +" Get this script's unique id +map <script> <SID>?? <SID>?? +let s:id = substitute( maparg('<SID>??'), '^<SNR>\(.*\)_??$', '\1', '' ) +unmap <script> <SID>?? + + +" Extract current Ada word across multiple lines +" AdaWord( [line, column] )\ +let s:AdaWordRegex = '\a\w*\(\_s*\.\_s*\a\w*\)*' +let s:AdaComment = "\\v^(\"[^\"]*\"|'.'|[^\"']){-}\\zs\\s*--.*" + +function! AdaWord(...) + if a:0 > 1 + let linenr = a:1 + let colnr = a:2 - 1 + else + let linenr = line('.') + let colnr = col('.') - 1 + endif + let line = substitute( getline(linenr), s:AdaComment, '', '' ) + " Cope with tag searching for items in comments; if we are, don't loop + " backards looking for previous lines + if colnr > strlen(line) + " We were in a comment + let line = getline(linenr) + let search_prev_lines = 0 + else + let search_prev_lines = 1 + endif + + " Go backwards until we find a match (Ada ID) that *doesn't* include our + " location - i.e., the previous ID. This is because the current 'correct' + " match will toggle matching/not matching as we traverse characters + " backwards. Thus, we have to find the previous unrelated match, exclude + " it, then use the next full match (ours). + " Remember to convert vim column 'colnr' [1..n] to string offset [0..(n-1)] + " ... but start, here, one after the required char. + let newcol = colnr + 1 + while 1 + let newcol = newcol - 1 + if newcol < 0 + " Have to include previous line from file + let linenr = linenr - 1 + if linenr < 1 || !search_prev_lines + " Start of file or matching in a comment + let linenr = 1 + let newcol = 0 + let ourmatch = match( line, s:AdaWordRegex ) + break + endif + " Get previous line, and prepend it to our search string + let newline = substitute( getline(linenr), s:AdaComment, '', '' ) + let newcol = strlen(newline) - 1 + let colnr = colnr + newcol + let line = newline . line + endif + " Check to see if this is a match excluding 'us' + let mend = newcol + matchend( strpart(line,newcol), s:AdaWordRegex ) - 1 + if mend >= newcol && mend < colnr + " Yes + let ourmatch = mend+1 + match( strpart(line,mend+1), s:AdaWordRegex ) + break + endif + endwhile + + " Got anything? + if ourmatch < 0 + return '' + else + let line = strpart( line, ourmatch) + endif + + " Now simply add further lines until the match gets no bigger + let matchstr = matchstr( line, s:AdaWordRegex ) + let lastline = line('$') + let linenr = line('.') + 1 + while linenr <= lastline + let lastmatch = matchstr + let line = line . substitute( getline(linenr), s:AdaComment, '', '' ) + let matchstr = matchstr( line, s:AdaWordRegex ) + if matchstr == lastmatch + break + endif + endwhile + + " Strip whitespace & return + return substitute( matchstr, '\s\+', '', 'g' ) +endfunction + + +" Word tag - include '.' and if Ada make uppercase +" Name allows a common JumpToTag() to look for an ft specific JumpToTag_ft(). +function! JumpToTag_ada(word,...) + if a:word == '' + " Get current word + let word = AdaWord() + if word == '' + return + endif + else + let word = a:word + endif + if a:0 > 0 + let mode = a:1 + else + let mode = 'tj' + endif + + let v:errmsg = '' + execute 'silent!' mode word + if v:errmsg != '' + if v:errmsg =~ '^E426:' " Tag not found + let ignorecase = &ignorecase + set ignorecase + execute mode word + let &ignorecase = ignorecase + else + " Repeat to give error + execute mode word + endif + endif +endfunction + + +" Word completion (^N/^R/^X^]) - force '.' inclusion +function! s:AdaCompletion(cmd) + set iskeyword+=46 + return a:cmd . "\<C-R>=<SNR>" . s:id . "_AdaCompletionEnd()\<CR>" +endfunction +function! s:AdaCompletionEnd() + set iskeyword-=46 + return '' +endfunction + + +" Backspace at end of line after auto-inserted commentstring '-- ' wipes it +function! s:AdaInsertBackspace() + let line = getline('.') + if col('.') > strlen(line) && match(line,'-- $') != -1 && match(&comments,'--') != -1 + return "\<bs>\<bs>\<bs>" + else + return "\<bs>" + endif +endfunction + + +" Reset cpoptions +let &cpoptions = s:cpoptions +unlet s:cpoptions + +" vim: sts=2 sw=2 : diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim new file mode 100644 index 0000000000..d45ef3bb25 --- /dev/null +++ b/runtime/ftplugin/ant.vim @@ -0,0 +1,43 @@ +" Vim filetype plugin file +" Language: ant +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2003 Sep 29 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "XML Files (*.xml)\t*.xml\n" . + \ "All Files (*.*)\t*.*\n" + +runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim +let b:did_ftplugin = 1 + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter +endif + +" Change the :browse e filter to primarily show Ant-related files. +if has("gui_win32") + let b:browsefilter = "Build Files (build.xml)\tbuild.xml\n" . + \ "Java Files (*.java)\t*.java\n" . + \ "Properties Files (*.prop*)\t*.prop*\n" . + \ "Manifest Files (*.mf)\t*.mf\n" . + \ s:browsefilter +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:browsefilter | " . s:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/art.vim b/runtime/ftplugin/art.vim new file mode 100644 index 0000000000..cb95e6bf8f --- /dev/null +++ b/runtime/ftplugin/art.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: ART-IM and ART*Enterprise +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: Apr 2, 2003 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +run ftplugin/lisp.vim + +setl lw-=if +setl lw+=def-art-fun,deffacts,defglobal,defrule,defschema, + \for,schema,while diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim new file mode 100644 index 0000000000..006e3ce206 --- /dev/null +++ b/runtime/ftplugin/aspvbs.vim @@ -0,0 +1,58 @@ +" Vim filetype plugin file +" Language: aspvbs +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2003 Sep 29 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n" . + \ "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +let b:did_ftplugin = 1 + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words +endif + +" ASP: Active Server Pages (with Visual Basic Script) +" thanks to Gontran BAERTS +if exists("loaded_matchit") + let s:notend = '\%(\<end\s\+\)\@<!' + let b:match_words = + \ s:notend . '\<If\>:^\s\+\<Else\>:\<ElseIf\>:\<end\s\+\<if\>,' . + \ s:notend . '\<Select\s\+\<Case\>:\<Case\>:\<Case\s\+\<Else\>:\<End\s\+\<Select\>,' . + \ '^\s*\<Sub\>:\<End\s\+\<Sub\>,' . + \ '^\s*\<Function\>:\<End\s\+\<Function\>,' . + \ '\<Class\>:\<End\s\+\<Class\>,' . + \ '^\s*\<Do\>:\<Loop\>,' . + \ '^\s*\<For\>:\<Next\>,' . + \ '\<While\>:\<Wend\>,' . + \ s:match_words +endif + +" Change the :browse e filter to primarily show ASP-related files. +if has("gui_win32") + let b:browsefilter="ASP Files (*.asp)\t*.asp\n" . s:browsefilter +endif + +let b:undo_ftplugin = "unlet! b:match_words b:browsefilter | " . s:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/automake.vim b/runtime/ftplugin/automake.vim new file mode 100644 index 0000000000..f25770c344 --- /dev/null +++ b/runtime/ftplugin/automake.vim @@ -0,0 +1,11 @@ +" Vim filetype plugin file +" Langugage: Automake +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/vim/ftplugin/pcp/automake/ +" Latest Revision: 2004-05-22 +" arch-tag: 3a78b0cd-27b2-410a-8e7b-51a1717c2a5b + +" Same as makefile filetype plugin for now. +runtime! ftplugin/make.vim ftplugin/make_*.vim ftplugin/make/*.vim + +" vim: set sts=2 sw=2: diff --git a/runtime/ftplugin/bib.vim b/runtime/ftplugin/bib.vim new file mode 100644 index 0000000000..b4cd20fa5e --- /dev/null +++ b/runtime/ftplugin/bib.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin +" Language: BibTeX +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: May 21, 2003 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +setl cindent diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim new file mode 100644 index 0000000000..3d507581fd --- /dev/null +++ b/runtime/ftplugin/c.vim @@ -0,0 +1,52 @@ +" Vim filetype plugin file +" Language: C +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2004 May 16 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +set cpo-=C + +let b:undo_ftplugin = "setl cin< fo< com<" + \ . "| if has('vms') | setl isk< | endif" + +setlocal cindent + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format dashed lists in comments. +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +" In VMS C keywords contain '$' characters. +if has("vms") + setlocal iskeyword+=$ +endif + +" Win32 can filter files in the browse dialog +if has("gui_win32") && !exists("b:browsefilter") + if &ft == "cpp" + let b:browsefil |