diff options
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 000000000..19ad58bdd --- /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 000000000..90d404fa6 --- /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 000000000..f63962f81 --- /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 000000000..06c057fc8 --- /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 000000000..d45ef3bb2 --- /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 000000000..cb95e6bf8 --- /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 000000000..006e3ce20 --- /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 000000000..f25770c34 --- /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 000000000..b4cd20fa5 --- /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 000000000..3d507581f --- /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:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . + \ "C Header Files (*.h)\t*.h\n" . + \ "C Source Files (*.c)\t*.c\n" . + \ "All Files (*.*)\t*.*\n" + elseif &ft == "chscript" + let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . + \ "C Header Files (*.h)\t*.h\n" . + \ "C Source Files (*.c)\t*.c\n" . + \ "All Files (*.*)\t*.*\n" + else + let b:browsefilter = "C Source Files (*.c)\t*.c\n" . + \ "C Header Files (*.h)\t*.h\n" . + \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . + \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . + \ "All Files (*.*)\t*.*\n" + endif +endif diff --git a/runtime/ftplugin/ch.vim b/runtime/ftplugin/ch.vim new file mode 100644 index 000000000..ed09003b1 --- /dev/null +++ b/runtime/ftplugin/ch.vim @@ -0,0 +1,17 @@ +" Vim filetype plugin file +" Language: Ch +" Maintainer: SoftIntegration, Inc. <info@softintegration.com> +" URL: http://www.softintegration.com/download/vim/ftplugin/ch.vim +" Last change: 2004 May 16 +" Created based on cpp.vim +" +" Ch is a C/C++ interpreter with many high level extensions +" + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Behaves just like C +runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim new file mode 100644 index 000000000..47d58ccb9 --- /dev/null +++ b/runtime/ftplugin/changelog.vim @@ -0,0 +1,256 @@ +" Vim filetype plugin file +" Language: generic Changelog file +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/vim/ftplugin/pcp/changelog/ +" Latest Revision: 2004-04-25 +" arch-tag: b00e2974-c559-4477-b7b2-3ef3f4061bdb +" Variables: +" g:changelog_timeformat - +" description: the timeformat used in ChangeLog entries. +" default: "%Y-%m-%d". +" g:changelog_username - +" description: the username to use in ChangeLog entries +" default: try to deduce it from environment variables and system files. +" Local Mappings: +" <Leader>o - +" adds a new changelog entry for the current user for the current date. +" Global Mappings: +" <Leader>o - +" switches to the ChangeLog buffer opened for the current directory, or +" opens it in a new buffer if it exists in the current directory. Then +" it does the same as the local <Leader>o described above. +" Notes: +" run 'runtime ftplugin/changelog.vim' to enable the global mapping for +" changelog files. +" TODO: +" should we perhaps open the ChangeLog file even if it doesn't exist already? +" Problem is that you might end up with ChangeLog files all over the place. + +" If 'filetype' isn't "changelog", we must have been to add ChangeLog opener +if &filetype == "changelog" + " 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 + + let cpo_save = &cpo + set cpo-=C + + " The format of the date-time field (should have been called dateformat) + if !exists("g:changelog_timeformat") + let g:changelog_timeformat = "%Y-%m-%d" + endif + + " Try to figure out a reasonable username of the form: + " Full Name <user@host> + if !exists("g:changelog_username") + if exists("$EMAIL_ADDRESS") + let g:changelog_username = $EMAIL_ADDRESS + elseif exists("$EMAIL") + let g:changelog_username = $EMAIL + else + " Get the users login name + let login = system('whoami') + if v:shell_error + let login = 'unknown' + else + let newline = stridx(login, "\n") + if newline != -1 + let login = strpart(login, 0, newline) + endif + endif + + " Try to full name from gecos field in /etc/passwd + if filereadable('/etc/passwd') + let name = substitute( + \system('cat /etc/passwd | grep ^`whoami`'), + \'^\%([^:]*:\)\{4}\([^:]*\):.*$', '\1', '') + endif + + " If there is no such file, or there was some other problem try + " others + if !filereadable('/etc/passwd') || v:shell_error + " Maybe the environment has something of interest + if exists("$NAME") + let name = $NAME + else + " No? well, use the login name and capitalize first + " character + let name = toupper(login[0]) . strpart(login, 1) + endif + endif + + " Only keep stuff before the first comma + let comma = stridx(name, ',') + if comma != -1 + let name = strpart(name, 0, comma) + endif + + " And substitute & in the real name with the login of our user + let amp = stridx(name, '&') + if amp != -1 + let name = strpart(name, 0, amp) . toupper(login[0]) . + \strpart(login, 1) . strpart(name, amp + 1) + endif + + " Get our hostname + let hostname = system("hostname") + if v:shell_error + let hostname = 'unknownhost' + else + let newline = stridx(hostname, "\n") + if newline != -1 + let hostname = strpart(hostname, 0, newline) + endif + endif + + " And finally set the username + let g:changelog_username = name.' <'.login.'@'.hostname.'>' + endif + endif + + " Format used for new date-entries + if !exists("g:changelog_new_date_format") + let g:changelog_new_date_format = "%d %u\n\n\t* %c\n\n" + endif + + " Format used for new entries to current date-entry + if !exists("g:changelog_new_entry_format") + let g:changelog_new_entry_format = "\t* %c" + endif + + if !exists("g:changelog_date_entry_search") + let g:changelog_date_entry_search = '^\s*%d\_s*%u' + endif + + " Substitutes specific items in new date-entry formats and search strings + " Can be done with substitute of course, but unclean, and need \@! then + function! s:substitute_items(str, date, user) + let str = a:str + let i = stridx(str, '%') + while i != -1 + let char = str[i + 1] + if char == '%' + let middle = '%' + elseif char == 'd' + let middle = a:date + elseif char == 'u' + let middle = a:user + elseif char == 'c' + let middle = '{cursor}' + else + let middle = char + endif + let str = strpart(str, 0, i) . middle . strpart(str, i + 2) + let i = stridx(str, '%') + endwhile + return str + endfunction + + function! s:position_cursor() + if search('{cursor}') > 0 + let pos = line('.') + let line = getline(pos) + let cursor = stridx(line, '{cursor}') + call setline(pos, substitute(line, '{cursor}', '', '')) + endif + startinsert! + endfunction + + " Internal function to create a new entry in the ChangeLog + function! s:new_changelog_entry() + " Deal with 'paste' option + let save_paste = &paste + let &paste = 1 + 1 + " Look for an entry for today by our user + let date = strftime(g:changelog_timeformat) + let search = s:substitute_items(g:changelog_date_entry_search, date, + \g:changelog_username) + if search(search) > 0 + " Ok, now we look for the end of the date-entry, and add an entry + let pos = nextnonblank(line('.') + 1) + let line = getline(pos) + while line =~ '^\s\+\S\+' + let pos = pos + 1 + let line = getline(pos) + endwhile + let insert = s:substitute_items(g:changelog_new_entry_format, + \'', '') + execute "normal! ".(pos - 1)."Go".insert + execute pos + else + " Flag for removing empty lines at end of new ChangeLogs + let remove_empty = line('$') == 1 + + " No entry today, so create a date-user header and insert an entry + let todays_entry = s:substitute_items(g:changelog_new_date_format, + \date, g:changelog_username) + " Make sure we have a cursor positioning + if stridx(todays_entry, '{cursor}') == -1 + let todays_entry = todays_entry.'{cursor}' + endif + + " Now do the work + execute "normal! i".todays_entry + if remove_empty + while getline('$') == '' + $delete + endwhile + endif + + 1 + endif + + call s:position_cursor() + + " And reset 'paste' option + let &paste = save_paste + endfunction + + if exists(":NewChangelogEntry") != 2 + map <buffer> <silent> <Leader>o <Esc>:call <SID>new_changelog_entry()<CR> + command! -nargs=0 NewChangelogEntry call s:new_changelog_entry() + endif + + let b:undo_ftplugin = "setl com< tw< fo< et< ai<" + + if &textwidth == 0 + setlocal textwidth=78 + endif + setlocal comments= + setlocal formatoptions+=t + setlocal noexpandtab + setlocal autoindent + + let &cpo = cpo_save +else + " Add the Changelog opening mapping + nmap <silent> <Leader>o :call <SID>open_changelog()<CR> + + function! s:open_changelog() + if filereadable('ChangeLog') + if bufloaded('ChangeLog') + let buf = bufnr('ChangeLog') + execute "normal! \<C-W>t" + while winbufnr(winnr()) != buf + execute "normal! \<C-W>w" + endwhile + else + split ChangeLog + endif + + if exists("g:mapleader") + execute "normal " . g:mapleader . "o" + else + execute "normal \\o" + endif + startinsert! + endif + endfunction +endif + +" vim: set sts=2 sw=2: diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim new file mode 100644 index 000000000..e4e1a412f --- /dev/null +++ b/runtime/ftplugin/config.vim @@ -0,0 +1,41 @@ +" Vim filetype plugin file +" Language: config +" 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 = "Bourne Shell Files (*.sh)\t*.sh\n" . + \ "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.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 configure-related files. +if has("gui_win32") + let b:browsefilter="Configure Scripts (configure.*)\tconfigure.*\n" . + \ s:browsefilter +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:browsefilter | " . b:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim new file mode 100644 index 000000000..8c3f211da --- /dev/null +++ b/runtime/ftplugin/cpp.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: C++ +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2001 Jan 15 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Behaves just like C +runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim new file mode 100644 index 000000000..7f45098a4 --- /dev/null +++ b/runtime/ftplugin/cs.vim @@ -0,0 +1,26 @@ +" Vim filetype plugin file +" Language: C# +" Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Tue, 09 Mar 2004 14:09:33 CET + +" 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 + +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:*/,:///,:// + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "C# Source Files (*.cs)\t*.cs\n" . + \ "All Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/csc.vim b/runtime/ftplugin/csc.vim new file mode 100644 index 000000000..d9f901086 --- /dev/null +++ b/runtime/ftplugin/csc.vim @@ -0,0 +1,26 @@ +" Vim filetype plugin file +" Language: csc +" 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 +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +if exists("loaded_matchit") + let b:match_words= + \ '\<fix\>:\<endfix\>,' . + \ '\<if\>:\<else\%(if\)\=\>:\<endif\>,' . + \ '\<!loopondimensions\>\|\<!looponselected\>:\<!endloop\>' +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:match_words" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim new file mode 100644 index 000000000..d053cbbde --- /dev/null +++ b/runtime/ftplugin/csh.vim @@ -0,0 +1,47 @@ +" Vim filetype plugin file +" Language: csh +" 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 +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal commentstring=#%s +setlocal formatoptions-=t +setlocal formatoptions+=crql + +" Csh: thanks to Johannes Zellner +" - Both foreach and end must appear alone on separate lines. +" - The words else and endif must appear at the beginning of input lines; +" the if must appear alone on its input line or after an else. +" - Each case label and the default label must appear at the start of a +" line. +" - while and end must appear alone on their input lines. +if exists("loaded_matchit") + let b:match_words = + \ '^\s*\<if\>.*(.*).*\<then\>:'. + \ '^\s*\<else\>\s\+\<if\>.*(.*).*\<then\>:^\s*\<else\>:'. + \ '^\s*\<endif\>,'. + \ '\%(^\s*\<foreach\>\s\+\S\+\|^s*\<while\>\).*(.*):'. + \ '\<break\>:\<continue\>:^\s*\<end\>,'. + \ '^\s*\<switch\>.*(.*):^\s*\<case\>\s\+:^\s*\<default\>:^\s*\<endsw\>' +endif + +" Change the :browse e filter to primarily show csh-related files. +if has("gui_win32") + let b:browsefilter="csh Scripts (*.csh)\t*.csh\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal commentstring< formatoptions<" . + \ " | unlet! b:match_words b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/css.vim b/runtime/ftplugin/css.vim new file mode 100644 index 000000000..05eb9fff0 --- /dev/null +++ b/runtime/ftplugin/css.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin file +" Language: CSS +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/vim/ftplugin/pcp/css/ +" Latest Revision: 2004-04-25 +" arch-tag: 5fa7c74f-bf1a-47c4-b06f-6efe8f48db3b + +" 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 + +let b:undo_ftplugin = "setl com<" + +setlocal comments=s1:/*,mb:*,ex:*/ + +" vim: set sts=2 sw=2: diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim new file mode 100644 index 000000000..32db5a73d --- /dev/null +++ b/runtime/ftplugin/debchangelog.vim @@ -0,0 +1,206 @@ +" Vim filetype plugin file +" Language: Debian Changelog +" Maintainer: Michael Piefel <piefel@informatik.hu-berlin.de> +" Last Change: 23 March 2004 + +if exists("g:did_changelog_ftplugin") + finish +endif + +" Don't load another plugin (this is global) +let g:did_changelog_ftplugin = 1 + +" Helper functions returning various data. +" Returns full name, either from $DEBFULLNAME or debianfullname. +" TODO Is there a way to determine name from anywhere else? +function <SID>FullName() + if exists("$DEBFULLNAME") + return $DEBFULLNAME + elseif exists("g:debianfullname") + return g:debianfullname + else + return "Your Name" + endif +endfunction + +" Returns email address, from $DEBEMAIL, $EMAIL or debianemail. +function <SID>Email() + if exists("$DEBEMAIL") + return $DEBEMAIL + elseif exists("$EMAIL") + return $EMAIL + elseif exists("g:debianemail") + return g:debianfullemail + else + return "your@email.address" + endif +endfunction + +" Returns date in RFC822 format. +function <SID>Date() + let savelang = v:lc_time + execute "language time C" + let dateandtime = strftime("%a, %d %b %Y %X %z") + execute "language time " . savelang + return dateandtime +endfunction + +function <SID>WarnIfNotUnfinalised() + if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + echohl WarningMsg + echo "The entry has not been unfinalised before editing." + echohl None + return 1 + endif + return 0 +endfunction + +function <SID>Finalised() + let savelinenum = line(".") + normal 1G + call search("^ -- ") + if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + let returnvalue = 1 + else + let returnvalue = 0 + endif + execute savelinenum + return returnvalue +endfunction + +" These functions implement the menus +function NewVersion() + " The new entry is unfinalised and shall be changed + amenu disable Changelog.New\ Version + amenu enable Changelog.Add\ Entry + amenu enable Changelog.Close\ Bug + amenu enable Changelog.Set\ Distribution + amenu enable Changelog.Set\ Urgency + amenu disable Changelog.Unfinalise + amenu enable Changelog.Finalise + call append(0, substitute(getline(1),'-\([[:digit:]]\+\))', '-Ü\1)', '')) + call append(1, "") + call append(2, "") + call append(3, " -- ") + call append(4, "") + call Distribution("unstable") + call Urgency("low") + normal 1G + call search(")") + normal h + normal + call setline(1, substitute(getline(1),'-Ü\([[:digit:]]\+\))', '-\1)', '')) + call AddEntry() +endfunction + +function AddEntry() + normal 1G + call search("^ -- ") + normal kk + call append(".", " * ") + normal jjj + let warn=<SID>WarnIfNotUnfinalised() + normal kk + if warn + echohl MoreMsg + call input("Hit ENTER") + echohl None + endif + startinsert! +endfunction + +function CloseBug() + normal 1G + call search("^ -- ") + let warn=<SID>WarnIfNotUnfinalised() + normal kk + call append(".", " * (closes: #" . input("Bug number to close: ") . ")") + normal j^ll + startinsert +endfunction + +function Distribution(dist) + call setline(1, substitute(getline(1), ") [[:lower:] ]*;", ") " . a:dist . ";", "")) +endfunction + +function Urgency(urg) + call setline(1, substitute(getline(1), "urgency=.*$", "urgency=" . a:urg, "")) +endfunction + +function <SID>UnfinaliseMenu() + " This means the entry shall be changed + amenu disable Changelog.New\ Version + amenu enable Changelog.Add\ Entry + amenu enable Changelog.Close\ Bug + amenu enable Changelog.Set\ Distribution + amenu enable Changelog.Set\ Urgency + amenu disable Changelog.Unfinalise + amenu enable Changelog.Finalise +endfunction + +function Unfinalise() + call <SID>UnfinaliseMenu() + normal 1G + call search("^ -- ") + call setline(".", " -- ") +endfunction + +function <SID>FinaliseMenu() + " This means the entry should not be changed anymore + amenu enable Changelog.New\ Version + amenu disable Changelog.Add\ Entry + amenu disable Changelog.Close\ Bug + amenu disable Changelog.Set\ Distribution + amenu disable Changelog.Set\ Urgency + amenu enable Changelog.Unfinalise + amenu disable Changelog.Finalise +endfunction + +function Finalise() + call <SID>FinaliseMenu() + normal 1G + call search("^ -- ") + call setline(".", " -- " . <SID>FullName() . " <" . <SID>Email() . "> " . <SID>Date()) +endfunction + + +function <SID>MakeMenu() + amenu &Changelog.&New\ Version :call NewVersion()<CR> + amenu Changelog.&Add\ Entry :call AddEntry()<CR> + amenu Changelog.&Close\ Bug :call CloseBug()<CR> + menu Changelog.-sep- <nul> + + amenu Changelog.Set\ &Distribution.&unstable :call Distribution("unstable")<CR> + amenu Changelog.Set\ Distribution.&frozen :call Distribution("frozen")<CR> + amenu Changelog.Set\ Distribution.&stable :call Distribution("stable")<CR> + menu Changelog.Set\ Distribution.-sep- <nul> + amenu Changelog.Set\ Distribution.frozen\ unstable :call Distribution("frozen unstable")<CR> + amenu Changelog.Set\ Distribution.stable\ unstable :call Distribution("stable unstable")<CR> + amenu Changelog.Set\ Distribution.stable\ frozen :call Distribution("stable frozen")<CR> + amenu Changelog.Set\ Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable")<CR> + + amenu Changelog.Set\ &Urgency.&low :call Urgency("low")<CR> + amenu Changelog.Set\ Urgency.&medium :call Urgency("medium")<CR> + amenu Changelog.Set\ Urgency.&high :call Urgency("high")<CR> + + menu Changelog.-sep- <nul> + amenu Changelog.U&nfinalise :call Unfinalise()<CR> + amenu Changelog.&Finalise :call Finalise()<CR> + + if <SID>Finalised() + call <SID>FinaliseMenu() + else + call <SID>UnfinaliseMenu() + endif +endfunction + +augroup changelogMenu +au BufEnter * if &filetype == "debchangelog" | call <SID>MakeMenu() | endif +au BufLeave * if &filetype == "debchangelog" | aunmenu Changelog | endif +augroup END + +" Debian changelogs are not supposed to have any other text width, +" so the user cannot override this setting +setlocal tw=78 +setlocal comments=f:* +let b:undo_ftplugin = "setlocal tw< comments<" diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim new file mode 100644 index 000000000..39a83c411 --- /dev/null +++ b/runtime/ftplugin/dosbatch.vim @@ -0,0 +1,21 @@ +" Vim filetype plugin file +" Language: MS-DOS .bat files +" Maintainer: Mike Williams <mrw@eandem.co.uk> +" Last Change: 5th February 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 + +" BAT comment formatting +setlocal comments=b:rem,b:@rem,b:REM,b:@REM,b::: +setlocal formatoptions-=t formatoptions+=rol + +" Define patterns for the browse file filter +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\nAll Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim new file mode 100644 index 000000000..991118779 --- /dev/null +++ b/runtime/ftplugin/dtd.vim @@ -0,0 +1,33 @@ +" Vim filetype plugin file +" Language: dtd +" 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 +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal commentstring=<!--%s--> + +if exists("loaded_matchit") + let b:match_words = '<!--:-->,<!:>' +endif + +" Change the :browse e filter to primarily show Java-related files. +if has("gui_win32") + let b:browsefilter="DTD Files (*.dtd)\t*.dtd\n" . + \ "XML Files (*.xml)\t*.xml\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal commentstring<" . + \ " | unlet! b:matchwords b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim new file mode 100644 index 000000000..d189bf465 --- /dev/null +++ b/runtime/ftplugin/fortran.vim @@ -0,0 +1,114 @@ +" Vim settings file +" Language: Fortran90 (and Fortran95, Fortran77, F and elf90) +" Version: 0.44 +" Last Change: 2003 May 18 +" URL: http://www.unb.ca/chem/ajit/ftplugin/fortran.vim +" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www.unb.ca/chem/ajit/> +" Usage: Do :help fortran-plugin from Vim + +" Only do these settings when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't do other file type settings for this buffer +let b:did_ftplugin = 1 + +" Determine whether this is a fixed or free format source file +" if this hasn't been done yet +if !exists("b:fortran_fixed_source") + if exists("fortran_free_source") + " User guarantees free source form + let b:fortran_fixed_source = 0 + elseif exists("fortran_fixed_source") + " User guarantees fixed source form + let b:fortran_fixed_source = 1 + else + " f90 and f95 allow both fixed and free source form + " assume fixed source form unless signs of free source form + " are detected in the first five columns of the first 25 lines + " Detection becomes more accurate and time-consuming if more lines + " are checked. Increase the limit below if you keep lots of comments at + " the very top of each file and you have a fast computer + let s:lmax = 25 + if ( s:lmax > line("$") ) + let s:lmax = line("$") + endif + let b:fortran_fixed_source = 1 + let s:ln=1 + while s:ln <= s:lmax + let s:test = strpart(getline(s:ln),0,5) + if s:test[0] !~ '[Cc*!#]' && s:test !~ '^ \+[!#]' && s:test =~ '[^ 0-9\t]' + let b:fortran_fixed_source = 0 + break + endif + let s:ln = s:ln + 1 + endwhile + endif +endif + +" Set comments and textwidth according to source type +if (b:fortran_fixed_source == 1) + setlocal comments=:!,:*,:C + " Fixed format requires a textwidth of 72 for code + setlocal tw=72 + " If you need to add "&" on continued lines so that the code is + " compatible with both free and fixed format, then you should do so + " in column 73 and uncomment the next line + " setlocal tw=73 +else + setlocal comments=:! + " Free format allows a textwidth of 132 for code but 80 is more usual + setlocal tw=80 +endif + +" Set commentstring for foldmethod=marker +setlocal cms=!%s + +" Tabs are not a good idea in Fortran so the default is to expand tabs +if !exists("fortran_have_tabs") + setlocal expandtab +endif + +" Set 'formatoptions' to break comment and text lines but allow long lines +setlocal fo+=tcql + +setlocal include=^#\\=\\s*include\\s\\+ + +let s:cposet=&cpoptions +set cpoptions-=C + +" Define patterns for the matchit plugin +if !exists("b:match_words") + let s:notend = '\%(\<end\s\+\)\@<!' + let s:notselect = '\%(\<select\s\+\)\@<!' + let s:notelse = '\%(\<end\s\+\|\<else\s\+\)\@<!' + let b:match_ignorecase = 1 + let b:match_words = + \ '\<select\s*case\>:' . s:notselect. '\<case\>:\<end\s*select\>,' . + \ s:notelse . '\<if\s*(.\+)\s*then\>:' . + \ '\<else\s*\%(if\s*(.\+)\s*then\)\=\>:\<end\s*if\>,'. + \ 'do\s\+\(\d\+\):\%(^\s*\)\@<=\1\s,'. + \ s:notend . '\<do\>:\<end\s*do\>,'. + \ s:notelse . '\<where\>:\<elsewhere\>:\<end\s*where\>,'. + \ s:notend . '\<type\s*[^(]:\<end\s*type\>,'. + \ s:notend . '\<interface\>:\<end\s*interface\>,'. + \ s:notend . '\<subroutine\>:\<end\s*subroutine\>,'. + \ s:notend . '\<function\>:\<end\s*function\>,'. + \ s:notend . '\<module\>:\<end\s*module\>,'. + \ s:notend . '\<program\>:\<end\s*program\>' +endif + +" File filters for :browse e +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Fortran Files (*.f;*.F;*.for;*.f77;*.f90;*.f95;*.fpp;*.ftn)\t*.f;*.F;*.for;*.f77;*.f90;*.f95;*.fpp;*.ftn\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl fo< com< tw< cms< et< inc<" + \ . "| unlet! b:match_ignorecase b:match_words b:browsefilter" + +let &cpoptions=s:cposet +unlet s:cposet + +" vim:sw=2 diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim new file mode 100644 index 000000000..7334b1584 --- /dev/null +++ b/runtime/ftplugin/html.vim @@ -0,0 +1,40 @@ +" Vim filetype plugin file +" Language: html +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2004 May 11 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal commentstring=<!--%s--> + +" HTML: thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_skip = 's:Comment' + let b:match_words = '<:>,' . + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . + \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +endif + +" Change the :browse e filter to primarily show HTML-related files. +if has("gui_win32") + let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm*\n" . + \ "JavaScript Files (*.js)\t*.js\n" . + \ "Cascading StyleSheets (*.css)\t*.css\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal commentstring<" + \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/ishd.vim b/runtime/ftplugin/ishd.vim new file mode 100644 index 000000000..63e1a747e --- /dev/null +++ b/runtime/ftplugin/ishd.vim @@ -0,0 +1,30 @@ +" Vim filetype plugin file +" Language: InstallShield (ft=ishd) +" Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Sat, 24 May 2003 11:55:36 CEST + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal nocindent +setlocal autoindent +setlocal foldmethod=syntax + +set cpo-=C + +" matchit support +if exists("loaded_matchit") + let b:match_ignorecase=0 + let b:match_words= + \ '\%(^\s*\)\@<=\<function\>\s\+[^()]\+\s*(:\%(^\s*\)\@<=\<begin\>\s*$:\%(^\s*\)\@<=\<return\>:\%(^\s*\)\@<=\<end\>\s*;\s*$,' . + \ '\%(^\s*\)\@<=\<repeat\>\s*$:\%(^\s*\)\@<=\<until\>\s\+.\{-}\s*;\s*$,' . + \ '\%(^\s*\)\@<=\<switch\>\s*(.\{-}):\%(^\s*\)\@<=\<\%(case\|default\)\>:\%(^\s*\)\@<=\<endswitch\>\s*;\s*$,' . + \ '\%(^\s*\)\@<=\<while\>\s*(.\{-}):\%(^\s*\)\@<=\<endwhile\>\s*;\s*$,' . + \ '\%(^\s*\)\@<=\<for\>.\{-}\<\%(to\|downto\)\>:\%(^\s*\)\@<=\<endfor\>\s*;\s*$,' . + \ '\%(^\s*\)\@<=\<if\>\s*(.\{-})\s*then:\%(^\s*\)\@<=\<else\s*if\>\s*([^)]*)\s*then:\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<endif\>\s*;\s*$' +endif + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "InstallShield Files (*.rul)\t*.rul\n" . + \ "All Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim new file mode 100644 index 000000000..ba0bf3310 --- /dev/null +++ b/runtime/ftplugin/java.vim @@ -0,0 +1,63 @@ +" Vim filetype plugin file +" Language: Java +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Change: 2004 May 16 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +" Go ahead and set this to get decent indenting even if the indent files +" aren't being used. For people who really don't want any indentation, +" let them turn it off. +if !exists("g:ftplugin_java_no_indent") + setlocal cindent + + "--------------------- + " Correctly indent anonymous classes + " From Johannes Zellner <johannes@zellner.org> + setlocal cinoptions+=j1 + "--------------------- +endif + +" For filename completion, prefer the .java extension over the .class +" extension. +set suffixes+=.class + +" Enable gf on import statements. Convert . in the package +" name to / and append .java to the name, then search the path. +setlocal includeexpr=substitute(v:fname,'\\.','/','g') +setlocal suffixesadd=.java +if exists("g:ftplugin_java_source_path") + let &l:path=g:ftplugin_java_source_path . ',' . &l:path +endif + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal formatoptions-=t formatoptions+=croql + +" Set 'comments' to format dashed lists in comments. Behaves just like C. +setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/ + +setlocal commentstring=//%s + +" Change the :browse e filter to primarily show Java-related files. +if has("gui_win32") + let b:browsefilter="Java Files (*.java)\t*.java\n" . + \ "Properties Files (*.prop*)\t*.prop*\n" . + \ "Manifest Files (*.mf)\t*.mf\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cindent< cinoptions< suffixes< suffixesadd<" . + \ " formatoptions< comments< commentstring< path< includeexpr<" . + \ " | unlet! b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/jsp.vim b/runtime/ftplugin/jsp.vim new file mode 100644 index 000000000..7c6ac84ef --- /dev/null +++ b/runtime/ftplugin/jsp.vim @@ -0,0 +1,66 @@ +" Vim filetype plugin file +" Language: jsp +" 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 = "Java Files (*.java)\t*.java\n" . + \ "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 +unlet b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +runtime! ftplugin/java.vim ftplugin/java_*.vim ftplugin/java/*.vim +let b:did_ftplugin = 1 + +" Combine the new set of values with those previously included. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +endif +if exists ("b:browsefilter") + let s:browsefilter = b:browsefilter . s:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words . ',' . s:matchwords +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +" Change the :browse e filter to primarily show JSP-related files. +if has("gui_win32") + let b:browsefilter="JSP Files (*.jsp)\t*.jsp\n" . s:browsefilter +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/kwt.vim b/runtime/ftplugin/kwt.vim new file mode 100644 index 000000000..7be64229c --- /dev/null +++ b/runtime/ftplugin/kwt.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin file +" Language: Kimwitu++ +" Maintainer: Michael Piefel <piefel@informatik.hu-berlin.de> +" Last Change: 16 August 2001 + +" Behaves almost like C++ +runtime! ftplugin/cpp.vim ftplugin/cpp_*.vim ftplugin/cpp/*.vim + +set cpo-=C + +" Limit the browser to related files +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Kimwitu/Kimwitu++ Files (*.k)\t*.k\n" . + \ "Lex/Flex Files (*.l)\t*.l\n" . + \ "Yacc/Bison Files (*.y)\t*.y\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Set the errorformat for the Kimwitu++ compiler +set efm+=kc%.%#:\ error\ at\ %f:%l:\ %m diff --git a/runtime/ftplugin/lisp.vim b/runtime/ftplugin/lisp.vim new file mode 100644 index 000000000..5bc25af87 --- /dev/null +++ b/runtime/ftplugin/lisp.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin +" Language: Lisp +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: May 15, 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 autoindent +setl comments=:; +setl define=^\\s*(def\\k* +setl formatoptions-=t +setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 +setl lisp diff --git a/runtime/ftplugin/lprolog.vim b/runtime/ftplugin/lprolog.vim new file mode 100644 index 000000000..1e73f0c2d --- /dev/null +++ b/runtime/ftplugin/lprolog.vim @@ -0,0 +1,37 @@ +" Vim settings file +" Language: LambdaProlog (Teyjus) +" Maintainer: Markus Mottl <markus@oefai.at> +" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/lprolog.vim +" Last Change: 2003 May 11 +" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) +" 2001 Sep 02 - initial release (MM) + +" Only do these settings when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't do other file type settings for this buffer +let b:did_ftplugin = 1 + +" Error format +setlocal efm=%+A./%f:%l.%c:\ %m formatprg=fmt\ -w75\ -p\\% + +" Formatting of comments +setlocal formatprg=fmt\ -w75\ -p\\% + +" Add mappings, unless the user didn't want this. +if !exists("no_plugin_maps") && !exists("no_lprolog_maps") + " Uncommenting + if !hasmapto('<Plug>Comment') + nmap <buffer> <LocalLeader>c <Plug>LUncomOn + vmap <buffer> <LocalLeader>c <Plug>BUncomOn + nmap <buffer> <LocalLeader>C <Plug>LUncomOff + vmap <buffer> <LocalLeader>C <Plug>BUncomOff + endif + + nnoremap <buffer> <Plug>LUncomOn mz0i/* <ESC>$A */<ESC>`z + nnoremap <buffer> <Plug>LUncomOff <ESC>:s/^\/\* \(.*\) \*\//\1/<CR> + vnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i/*<ESC>`>o<ESC>0i*/<ESC>`< + vnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`< +endif diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim new file mode 100644 index 000000000..3bc640f3f --- /dev/null +++ b/runtime/ftplugin/lua.vim @@ -0,0 +1,36 @@ +" Vim filetype plugin file. +" Language: Lua 4.0+ +" Maintainer: Max Ischenko <mfi@ukr.net> +" Last Change: 2001 Sep 17 + +" 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 '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 + +setlocal com=:-- +setlocal cms="--%s" +setlocal suffixesadd=.lua + + +" The following lines enable the macros/matchit.vim plugin for +" extended matching with the % key. + +set cpo-=C +if exists("loaded_matchit") + + let b:match_ignorecase = 0 + let b:match_words = + \ '\<\%(do\|function\|if\)\>:' . + \ '\<\%(return\|else\|elseif\)\>:' . + \ '\<end\>,' . + \ '\<repeat\>:\<until\>' + +endif " exists("loaded_matchit") diff --git a/runtime/ftplugin/mail.vim b/runtime/ftplugin/mail.vim new file mode 100644 index 000000000..16bf19758 --- /dev/null +++ b/runtime/ftplugin/mail.vim @@ -0,0 +1,34 @@ +" Vim filetype plugin file +" Language: Mail +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2004 Feb 20 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl modeline< tw< fo<" + +" Don't use modelines in e-mail messages, avoid trojan horses +setlocal nomodeline + +" many people recommend keeping e-mail messages 72 chars wide +if &tw == 0 + setlocal tw=72 +endif + +" Set 'formatoptions' to break text lines and keep the comment leader ">". +setlocal fo+=tcql + +" Add mappings, unless the user didn't want this. +if !exists("no_plugin_maps") && !exists("no_mail_maps") + " Quote text by inserting "> " + if !hasmapto('<Plug>MailQuote') + vmap <buffer> <LocalLeader>q <Plug>MailQuote + nmap <buffer> <LocalLeader>q <Plug>MailQuote + endif + vnoremap <buffer> <Plug>MailQuote :s/^/> /<CR>:noh<CR>`` + nnoremap <buffer> <Plug>MailQuote :.,$s/^/> /<CR>:noh<CR>`` +endif diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim new file mode 100644 index 000000000..c7397da7a --- /dev/null +++ b/runtime/ftplugin/make.vim @@ -0,0 +1,25 @@ +" Vim filetype plugin file +" Language: Make +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2003 May 04 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl et< fo< com< commentstring<" + +" Make sure a hard tab is used, required for most make programs +setlocal noexpandtab softtabstop=0 + +" 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 com=sO:#\ -,mO:#\ \ ,b:# + +" Set 'commentstring' to put the marker after a #. +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim new file mode 100644 index 000000000..869ae9ab7 --- /dev/null +++ b/runtime/ftplugin/man.vim @@ -0,0 +1,177 @@ +" Vim filetype plugin file +" Language: man +" Maintainer: Nam SungHyun <namsh@kldp.org> +" Last Change: 2003 Dec 24 + +" To make the ":Man" command available before editing a manual page, source +" this script from your startup vimrc file. + +" If 'filetype' isn't "man", we must have been called to only define ":Man". +if &filetype == "man" + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + let b:did_ftplugin = 1 + + " allow dot and dash in manual page name. + setlocal iskeyword+=\.,- + + " Add mappings, unless the user didn't want this. + if !exists("no_plugin_maps") && !exists("no_man_maps") + if !hasmapto('<Plug>ManBS') + nmap <buffer> <LocalLeader>h <Plug>ManBS + endif + nnoremap <buffer> <Plug>ManBS :%s/.\b//g<CR>:set nomod<CR>'' + + nnoremap <buffer> <c-]> :call <SID>PreGetPage(v:count)<CR> + nnoremap <buffer> <c-t> :call <SID>PopPage()<CR> + endif + +endif + +if exists(":Man") != 2 + com -nargs=+ Man call s:GetPage(<f-args>) + nmap <Leader>K :call <SID>PreGetPage(0)<CR> +endif + +" Define functions only once. +if !exists("s:man_tag_depth") + +let s:man_tag_depth = 0 + +if !has("win32") && $OSTYPE !~ 'cygwin\|linux' && system('uname -s') =~ "SunOS" && system('uname -r') =~ "^5" + let s:man_sect_arg = "-s" + let s:man_find_arg = "-l" +else + let s:man_sect_arg = "" + let s:man_find_arg = "-w" +endif + +func <SID>PreGetPage(cnt) + if a:cnt == 0 + let old_isk = &iskeyword + setl iskeyword+=(,) + let str = expand("<cword>") + let &l:iskeyword = old_isk + let page = substitute(str, '(*\(\k\+\).*', '\1', '') + let sect = substitute(str, '\(\k\+\)(\([^()]*\)).*', '\2', '') + if match(sect, '^[0-9 ]\+$') == -1 + let sect = "" + endif + if sect == page + let sect = "" + endif + else + let sect = a:cnt + let page = expand("<cword>") + endif + call s:GetPage(sect, page) +endfunc + +func <SID>GetCmdArg(sect, page) + if a:sect == '' + return a:page + endif + return s:man_sect_arg.' '.a:sect.' '.a:page +endfunc + +func <SID>FindPage(sect, page) + let where = system("/usr/bin/man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page)) + if where !~ "^/" + if matchstr(where, " [^ ]*$") !~ "^ /" + return 0 + endif + endif + return 1 +endfunc + +func <SID>GetPage(...) + if a:0 >= 2 + let sect = a:1 + let page = a:2 + elseif a:0 >= 1 + let sect = "" + let page = a:1 + else + return + endif + + " To support: nmap K :Man <cword> + if page == '<cword>' + let page = expand('<cword>') + endif + + if sect != "" && s:FindPage(sect, page) == 0 + let sect = "" + endif + if s:FindPage(sect, page) == 0 + echo "\nCannot find a '".page."'." + return + endif + exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%") + exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".") + exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".") + let s:man_tag_depth = s:man_tag_depth + 1 + + " Use an existing "man" window if it exists, otherwise open a new one. + if &filetype != "man" + let thiswin = winnr() + exe "norm! \<C-W>b" + if winnr() == 1 + new + else + exe "norm! " . thiswin . "\<C-W>w" + while 1 + if &filetype == "man" + break + endif + exe "norm! \<C-W>w" + if thiswin == winnr() + new + break + endif + endwhile + endif + endif + silent exec "edit $HOME/".page.".".sect."~" + " Avoid warning for editing the dummy file twice + set buftype=nofile noswapfile + + set ma + silent exec "norm 1GdG" + let $MANWIDTH = winwidth(0) + silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b" + " Remove blank lines from top and bottom. + while getline(1) =~ '^\s*$' + silent norm ggdd + endwhile + while getline('$') =~ '^\s*$' + silent norm Gdd + endwhile + 1 + setl ft=man nomod + setl bufhidden=hide + setl nobuflisted +endfunc + +func <SID>PopPage() + if s:man_tag_depth > 0 + let s:man_tag_depth = s:man_tag_depth - 1 + exec "let s:man_tag_buf=s:man_tag_buf_".s:man_tag_depth + exec "let s:man_tag_lin=s:man_tag_lin_".s:man_tag_depth + exec "let s:man_tag_col=s:man_tag_col_".s:man_tag_depth + exec s:man_tag_buf."b" + exec s:man_tag_lin + exec "norm ".s:man_tag_col."|" + exec "unlet s:man_tag_buf_".s:man_tag_depth + exec "unlet s:man_tag_lin_".s:man_tag_depth + exec "unlet s:man_tag_col_".s:man_tag_depth + unlet s:man_tag_buf s:man_tag_lin s:man_tag_col + endif +endfunc + +endif + +" vim: set sw=2: diff --git a/runtime/ftplugin/mf.vim b/runtime/ftplugin/mf.vim new file mode 100644 index 000000000..b066d531e --- /dev/null +++ b/runtime/ftplugin/mf.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: METAFONT +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: May 27, 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 com=:% +setl fo-=t diff --git a/runtime/ftplugin/mp.vim b/runtime/ftplugin/mp.vim new file mode 100644 index 000000000..3385565b3 --- /dev/null +++ b/runtime/ftplugin/mp.vim @@ -0,0 +1,7 @@ +" Vim filetype plugin +" Language: MetaPost +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: May 27, 2003 + +runtime! ftplugin/mf.vim ftplugin/mf_*.vim ftplugin/mf/*.vim diff --git a/runtime/ftplugin/objc.vim b/runtime/ftplugin/objc.vim new file mode 100644 index 000000000..e41beb5da --- /dev/null +++ b/runtime/ftplugin/objc.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: Objective C +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2003 Jan 15 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Behaves just like C +runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim new file mode 100644 index 000000000..96f2c0c78 --- /dev/null +++ b/runtime/ftplugin/ocaml.vim @@ -0,0 +1,49 @@ +" Vim settings file +" Language: OCaml +" Maintainers: Mike Leary <leary@nwlink.com> +" Markus Mottl <markus@oefai.at> +" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/ocaml.vim +" Last Change: 2003 May 11 +" 2001 Nov 01 - added local bindings for inserting +" type holes using 'assert false' (MM) +" 2001 Oct 02 - insert spaces in line comments (MM) + +" Only do these settings when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't do other file type settings for this buffer +let b:did_ftplugin = 1 + +set cpo-=C + +" Error formats +setlocal efm= + \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, + \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, + \%+EReference\ to\ unbound\ regexp\ name\ %m, + \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, + \%Wocamlyacc:\ w\ -\ %m, + \%-Zmake%.%#, + \%C%m + +" Add mappings, unless the user didn't want this. +if !exists("no_plugin_maps") && !exists("no_ocaml_maps") + " Uncommenting + if !hasmapto('<Plug>Comment') + nmap <buffer> <LocalLeader>c <Plug>LUncomOn + vmap <buffer> <LocalLeader>c <Plug>BUncomOn + nmap <buffer> <LocalLeader>C <Plug>LUncomOff + vmap <buffer> <LocalLeader>C <Plug>BUncomOff + endif + + nnoremap <buffer> <Plug>LUncomOn mz0i(* <ESC>$A *)<ESC>`z + nnoremap <buffer> <Plug>LUncomOff <ESC>:s/^(\* \(.*\) \*)/\1/<CR> + vnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i(*<ESC>`>o<ESC>0i*)<ESC>`< + vnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`< + + if !hasmapto('<Plug>Abbrev') + iabbrev <buffer> ASS (assert false) + endif +endif diff --git a/runtime/ftplugin/occam.vim b/runtime/ftplugin/occam.vim new file mode 100644 index 000000000..ed2c4f4ea --- /dev/null +++ b/runtime/ftplugin/occam.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin file +" Language: occam +" Copyright: Christian Jacobsen <clj3@kent.ac.uk>, Mario Schweigler <ms44@kent.ac.uk> +" Maintainer: Mario Schweigler <ms44@kent.ac.uk> +" Last Change: 23 April 2003 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +"{{{ Indent settings +" Set shift width for indent +setlocal shiftwidth=2 +" Set the tab key size to two spaces +setlocal softtabstop=2 +" Let tab keys always be expanded to spaces +setlocal expandtab +"}}} + +"{{{ Formatting +" Break comment lines and insert comment leader in this case +setlocal formatoptions-=t formatoptions+=cql +setlocal comments+=:-- +" Maximum length of comments is 78 +setlocal textwidth=78 +"}}} + +"{{{ File browsing filters +" Win32 can filter files in the browse dialog +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "All Occam Files (*.occ *.inc)\t*.occ;*.inc\n" . + \ "Occam Include Files (*.inc)\t*.inc\n" . + \ "Occam Source Files (*.occ)\t*.occ\n" . + \ "All Files (*.*)\t*.*\n" +endif +"}}} + diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim new file mode 100644 index 000000000..a3e8f8160 --- /dev/null +++ b/runtime/ftplugin/pascal.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: pascal +" 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 +let b:did_ftplugin = 1 + +if exists("loaded_matchit") + let b:match_words='\<begin\>:\<end\>' +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:match_words" diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim new file mode 100644 index 000000000..9f714a9fe --- /dev/null +++ b/runtime/ftplugin/perl.vim @@ -0,0 +1,66 @@ +" Vim filetype plugin file +" Language: Perl +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Change: 2004 May 16 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal formatoptions+=crq + +setlocal comments=:# +setlocal commentstring=#%s + +" Change the browse dialog on Win32 to show mainly Perl-related files +if has("gui_win32") + let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . + \ "Perl Modules (*.pm)\t*.pm\n" . + \ "Perl Documentation Files (*.pod)\t*.pod\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Provided by Ned Konz <ned at bike-nomad dot com> +"--------------------------------------------- +setlocal include=\\<\\(use\|require\\)\\> +setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','') +setlocal define=[^A-Za-z_] + +" The following line changes a global variable but is necessary to make +" gf and similar commands work. The change to iskeyword was incorrect. +" Thanks to Andrew Pimlott for pointing out the problem. If this causes a +" problem for you, add an after/ftplugin/perl.vim file that contains +" set isfname-=: +set isfname+=: +"setlocal iskeyword=48-57,_,A-Z,a-z,: + +" Set this once, globally. +if !exists("perlpath") + if executable("perl") + if &shellxquote != '"' + let perlpath = system('perl -e "print join(q/,/,@INC)"') + else + let perlpath = system("perl -e 'print join(q/,/,@INC)'") + endif + let perlpath = substitute(perlpath,',.$',',,','') + else + " If we can't call perl to get its path, just default to using the + " current directory and the directory of the current file. + let perlpath = ".,," + endif +endif + +let &l:path=perlpath +"--------------------------------------------- + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf<" . + \ " | unlet! b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim new file mode 100644 index 000000000..a1c732979 --- /dev/null +++ b/runtime/ftplugin/php.vim @@ -0,0 +1,62 @@ +" Vim filetype plugin file +" Language: php +" 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 + +" Change the :browse e filter to primarily show PHP-related files. +if has("gui_win32") + let b:browsefilter="PHP Files (*.php)\t*.php\n" . s:browsefilter +endif + +" ### +" Provided by Mikolaj Machowski <mikmach at wp dot pl> +setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\? +setlocal iskeyword+=$ +if exists("loaded_matchit") + let b:match_words = '\<switch\>:\<endswitch\>,' . + \ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' . + \ '\<while\>:\<endwhile\>,' . + \ '\<do\>:\<while\>,' . + \ '\<for\>:\<endfor\>,' . + \ '\<foreach\>:\<endforeach\>,' . + \ s:match_words +endif +" ### + +setlocal commentstring=/*%s*/ + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms< inc< isk<" . + \ " | unlet! b:browsefilter b:match_words | " . + \ s:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/postscr.vim b/runtime/ftplugin/postscr.vim new file mode 100644 index 000000000..56f4e249c --- /dev/null +++ b/runtime/ftplugin/postscr.vim @@ -0,0 +1,31 @@ +" Vim filetype plugin file +" Language: PostScript +" Maintainer: Mike Williams <mrw@eandem.co.uk> +" Last Change: 27th June 2002 + +" 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 + +" PS comment formatting +setlocal comments=b:% +setlocal formatoptions-=t formatoptions+=rol + +" Define patterns for the matchit macro +if !exists("b:match_words") + let b:match_ignorecase = 0 + let b:match_words = '<<:>>,\<begin\>:\<end\>,\<save\>:\<restore\>,\<gsave\>:\<grestore\>' +endif + +set cpo-=C + +" Define patterns for the browse file filter +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "PostScript Files (*.ps)\t*.ps\n" . + \ "EPS Files (*.eps)\t*.eps\n" . + \ "All Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/pyrex.vim b/runtime/ftplugin/pyrex.vim new file mode 100644 index 000000000..69bd93dd1 --- /dev/null +++ b/runtime/ftplugin/pyrex.vim @@ -0,0 +1,22 @@ +" Vim filetype plugin file +" Language: Pyrex +" Maintainer: Marco Barisione <marco.bari@people.it> +" URL: http://marcobari.altervista.org/pyrex_vim.html +" Last Change: 2004 May 16 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Behaves just like Python +runtime! ftplugin/python.vim ftplugin/python_*.vim ftplugin/python/*.vim + +if has("gui_win32") && exists("b:browsefilter") + let b:browsefilter = "Pyrex files (*.pyx,*.pxd)\t*.pyx;*.pxd\n" . + \ "Python Files (*.py)\t*.py\n" . + \ "C Source Files (*.c)\t*.c\n" . + \ "C Header Files (*.h)\t*.h\n" . + \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . + \ "All Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim new file mode 100644 index 000000000..4834b40ce --- /dev/null +++ b/runtime/ftplugin/python.vim @@ -0,0 +1,41 @@ +" Vim filetype plugin file +" Language: python +" Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Wed, 21 Apr 2004 13:13:08 CEST + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal cinkeys-=0# +setlocal indentkeys-=0# +setlocal include=\s*\\(from\\\|import\\) +setlocal includeexpr=substitute(v:fname,'\\.','/','g') +setlocal suffixesadd=.py +setlocal comments-=:% +setlocal commentstring=#%s + +set wildignore+=*.pyc + +nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr> +nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr> +nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr> +nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr> + +if exists('*<SID>Python_jump') | finish | endif + +fun! <SID>Python_jump(motion) range + let cnt = v:count1 + let save = @/ " save last search pattern + mark ' + while cnt > 0 + silent! exe a:motion + let cnt = cnt - 1 + endwhile + call histdel('/', -1) + let @/ = save " restore last search pattern +endfun + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Python Files (*.py)\t*.py\n" . + \ "All Files (*.*)\t*.*\n" +endif diff --git a/runtime/ftplugin/rpl.vim b/runtime/ftplugin/rpl.vim new file mode 100644 index 000000000..2b26ef1fa --- /dev/null +++ b/runtime/ftplugin/rpl.vim @@ -0,0 +1,22 @@ +" Vim filetype plugin file +" Language: RPL/2 +" Maintainer: Joël BERTRAND <rpl2@free.fr> +" Last Change: 2002 Feb 07 +" Version: 0.1 + +" 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 + +setlocal autoindent + +" 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:*/,:// diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim new file mode 100644 index 000000000..98dd5a07b --- /dev/null +++ b/runtime/ftplugin/rst.vim @@ -0,0 +1,23 @@ +" Vim filetype plugin file +" Language: reStructuredText Documentation Format +" Maintainer: Nikolai Weibull <source@pcppopper.org> +" URL: http://www.pcppopper.org/vim/ftplugin/pcp/rst/ +" Latest Revision: 2004-04-25 +" arch-tag: 618bf504-81ba-4518-bad2-43ba2b844a26 + +" 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 + +let b:undo_ftplugin = "setl com< cms<" + +setlocal comments=fb:.. +setlocal commentstring=..\ %s +setlocal expandtab +setlocal sts=2 sw=2 + +" vim: set sts=2 sw=2: diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim new file mode 100644 index 000000000..e21afeee5 --- /dev/null +++ b/runtime/ftplugin/ruby.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: Ruby +" Maintainer: Gavin Sinclair <gsinclair@soyabean.com.au> +" Last Change: 2002/08/12 +" URL: www.soyabean.com.au/gavin/vim/index.html + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif +let b:did_ftplugin = 1 + +" There are no known setting particularly appropriate for Ruby. Please +" contact the maintainer if you think of some. diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim new file mode 100644 index 000000000..7d34f7217 --- /dev/null +++ b/runtime/ftplugin/scheme.vim @@ -0,0 +1,7 @@ +" Vim filetype plugin +" Language: Scheme +" Maintainer: Dorai Sitaram <ds26@gte.com> +" URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html +" Last Change: Apr 2, 2003 + +run ftplugin/lisp.vim diff --git a/runtime/ftplugin/sgml.vim b/runtime/ftplugin/sgml.vim new file mode 100644 index 000000000..4a19ddae7 --- /dev/null +++ b/runtime/ftplugin/sgml.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin file +" Language: sgml +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2003 Sep 30 +" 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 xml-related files. +if has("gui_win32") + let b:browsefilter="SGML Files (*.sgml,*.sgm)\t*.sgm*\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/sh.vim b/runtime/ftplugin/sh.vim new file mode 100644 index 000000000..183215a12 --- /dev/null +++ b/runtime/ftplugin/sh.vim @@ -0,0 +1,38 @@ +" Vim filetype plugin file +" Language: sh +" 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 +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal commentstring=#%s + +" Shell: thanks to Johannes Zellner +if exists("loaded_matchit") + let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line + let b:match_words = + \ s:sol.'if\>:' . s:sol.'elif\>:' . s:sol.'else\>:' . s:sol. 'fi\>,' . + \ s:sol.'\%(for\|while\)\>:' . s:sol. 'done\>,' . + \ s:sol.'case\>:' . s:sol. 'esac\>' +endif + +" Change the :browse e filter to primarily show shell-related files. +if has("gui_win32") + let b:browsefilter="Bourne Shell Scripts (*.sh)\t*.sh\n" . + \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" . + \ "Bash Shell Scripts (*.bash)\t*.bash\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms< | unlet! b:browsefilter b:match_words" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim new file mode 100644 index 000000000..3b1d70a48 --- /dev/null +++ b/runtime/ftplugin/spec.vim @@ -0,0 +1,168 @@ +" Plugin to update the %changelog section of RPM spec files +" Filename: spec.vim +" Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> +" Last Change: Wed, 10 Apr 2002 16:28:52 -0300 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +if !exists("no_plugin_maps") && !exists("no_spec_maps") + if !hasmapto("<Plug>SpecChangelog") + map <buffer> <LocalLeader>c <Plug>SpecChangelog + endif +endif + +noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR> + +if !exists("*s:SpecChangelog") + function s:SpecChangelog(format) + if strlen(a:format) == 0 + if !exists("g:spec_chglog_format") + let email = input("Email address: ") + let g:spec_chglog_format = "%a %b %d %Y " . l:email + echo "\r" + endif + let format = g:spec_chglog_format + else + if !exists("g:spec_chglog_format") + let g:spec_chglog_format = a:format + endif + let format = a:format + endif + let line = 0 + let name = "" + let ver = "" + let rel = "" + let nameline = -1 + let verline = -1 + let relline = -1 + let chgline = -1 + while (line <= line("$")) + let linestr = getline(line) + if (name == "" && linestr =~? '^Name:') + let nameline = line + let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','') + elseif (ver == "" && linestr =~? '^Version:') + let verline = line + let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') + elseif (rel == "" && linestr =~? '^Release:') + let relline = line + let rel = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') + elseif (linestr =~? '^%changelog') + let chgline = line + execute line + break + endif + let line = line+1 + endwhile + if (nameline != -1 && verline != -1 && relline != -1) + let include_release_info = exists("g:spec_chglog_release_info") + let name = s:ParseRpmVars(name, nameline) + let ver = s:ParseRpmVars(ver, verline) + let rel = s:ParseRpmVars(rel, relline) + else + let include_release_info = 0 + endif + if (chgline == -1) + let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3) + if (option == 1) + call append(line("$"),"") + call append(line("$"),"%changelog") + execute line("$") + let chgline = line(".") + elseif (option == 2) + call append(line("."),"%changelog") + normal j + chgline = line(".") + endif + endif + if (chgline != -1) + let parsed_format = "* ".strftime(format) + let release_info = "+ ".name."-".ver."-".rel + let wrong_format = 0 + let wrong_release = 0 + let insert_line = 0 + if (getline(chgline+1) != parsed_format) + let wrong_format = 1 + endif + if (include_release_info && getline(chgline+2) != release_info) + let wrong_release = 1 + endif + if (wrong_format || wrong_release) + if (include_release_info && !wrong_release && !exists("g:spec_chglog_never_increase_release")) + let option = confirm("Increase release? ","&Yes\n&No",1) + if (option == 1) + execute relline + normal + let rel = substitute(strpart(getline(relline),8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') + let release_info = "+ ".name."-".ver."-".rel + endif + endif + let n = 0 + call append(chgline+n, parsed_format) + if include_release_info + let n = n + 1 + call append(chgline+n, release_info) + endif + let n = n + 1 + call append(chgline+n,"- ") + let n = n + 1 + call append(chgline+n,"") + let insert_line = chgline+n + else + let line = chgline + if !exists("g:spec_chglog_prepend") + while !(getline(line+2) =~ '^\( *\|\*.*\)$') + let line = line+1 + endwhile + endif + call append(line+1,"- ") + let insert_line = line+2 + endif + execute insert_line + startinsert! + endif + endfunction +endif + +if !exists("*s:ParseRpmVars") + function s:ParseRpmVars(str, strline) + let end = -1 + let ret = "" + while (1) + let start = match(a:str, "\%{", end+1) + if (start == -1) + let ret = ret . strpart(a:str, end+1) + break + endif + let ret = ret . strpart(a:str, end+1, start-(end+1)) + let end = match(a:str, "}", start) + if (end == -1) + let ret = ret . strpart(a:str, start) + break + endif + let varname = strpart(a:str, start+2, end-(start+2)) + execute a:strline + let definestr = "^[ \t]*%define[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$" + let linenum = search(definestr, "bW") + if (linenum != -1) + let ret = ret . substitute(getline(linenum), definestr, "\\1", "") + else + let ret = ret . strpart(str, start, end+1-start) + endif + endwhile + return ret + endfunction +endif + +" The following lines, along with the macros/matchit.vim plugin, +" make it easy to navigate the different sections of a spec file +" with the % key (thanks to Max Ischenko). + +let b:match_ignorecase = 0 +let b:match_words = + \ '^Name:^%description:^%clean:^%setup:^%build:^%install:^%files:' . + \ '^%package:^%preun:^%postun:^%changelog' + diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim new file mode 100644 index 000000000..afbdf555c --- /dev/null +++ b/runtime/ftplugin/sql.vim @@ -0,0 +1,35 @@ +" Vim filetype plugin file +" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) +" Version: 0.02 +" Maintainer: David Fishburn <fishburn@ianywhere.com> +" Last Change: Tue May 27 2003 09:33:31 + +" This file should only contain values that are common to all SQL languages +" Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on +" If additional features are required create: +" vimfiles/after/ftplugin/sql.vim +" to override and add any of your own settings + +" 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 + +" Define patterns for the matchit macro +if !exists("b:match_words") + " SQL is generally case insensitive + let b:match_ignorecase = 1 + let b:match_words = + \ '\<begin\>:\<end\>\(;\)\?$,'. + \ '\<if\>:\<elsif\>:\<elseif\>:\<else\>:'. + \ '\%(\<end\s\+\)\@<!' . '\<if\>:\<end\s\+if\>,'. + \ '\<loop\>:\<break\>:\<continue\>:'. + \ '\%(\<end\s\+\)\@<!' . '\<loop\>:\<end\s\+loop\>,'. + \ '\<for\>:\<break\>:\<continue\>:'. + \ '\%(\<end\s\+\)\@<!' . '\<for\>:\<end\s\+for\>,'. + \ '\<case\>:\<when\>:\<default\>:'. + \ '\%(\<end\s\+\)\@<!' . '\<case\>:\<end\s\+case\>' +endif diff --git a/runtime/ftplugin/svg.vim b/runtime/ftplugin/svg.vim new file mode 100644 index 000000000..4544172d0 --- /dev/null +++ b/runtime/ftplugin/svg.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin file +" Language: svg +" 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 xml-related files. +if has("gui_win32") + let b:browsefilter="SVG Files (*.svg)\t*.svg\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/tcsh.vim b/runtime/ftplugin/tcsh.vim new file mode 100644 index 000000000..4c724e68b --- /dev/null +++ b/runtime/ftplugin/tcsh.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin file +" Language: tcsh +" 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 = "csh Files (*.csh)\t*.csh\n" . + \ "All Files (*.*)\t*.*\n" + +runtime! ftplugin/csh.vim ftplugin/csh_*.vim ftplugin/csh/*.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 tcsh-related files. +if has("gui_win32") + let b:browsefilter="tcsh Scripts (*.tcsh)\t*.tcsh\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/tex.vim b/runtime/ftplugin/tex.vim new file mode 100644 index 000000000..1871e8fd5 --- /dev/null +++ b/runtime/ftplugin/tex.vim @@ -0,0 +1,112 @@ +" LaTeX filetype plugin +" Language: LaTeX (ft=tex) +" Maintainer: Benji Fisher, Ph.D. <benji@member.AMS.org> +" Version: 1.2 +" Last Change: Tue 11 May 2004 04:49:20 PM EDT +" URL: http://www.vim.org/script.php?script_id=411 + +" 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 + +let s:save_cpo = &cpo +set cpo&vim + +" This may be used to set b:tex_flavor. A more complete version can be found +" in foo.vim (see http://www.vim.org/script.php?script_id=72). +if !exists("*s:GetModelines") + fun! s:GetModelines(pat, ...) + " Long but simple: set start line and finish line. + let EOF = line("$") + if a:0 > 1 + let start = a:1 | let finish = a:2 + elseif a:0 == 1 + if a:1 > 0 + let finish = a:1 + else + let start = EOF + a:1 + 1 + endif + endif + if !exists("start") || start < 1 + let start = 1 + endif + if !exists("finish") || finish > EOF + let finish = EOF + endif + let n = 0 + silent! execute start .",". finish + \ 'g/' . escape(a:pat, "/") . "/let n=line('.')" + if n + execute "normal!\<C-O>" + endif + return n . ":" + endfun +endif " !exists("*GetModelines") + +" Define the buffer-local variable b:tex_flavor to "tex" (for plain) or +" "latex". +" 1. Check the first line of the file for "%&<format>". +" 2. Check the first 1000 lines for "\begin{document}". +" 3. Check for a global variable g:tex_flavor, can be set in user's vimrc. +" 4. Default to "latex". +" 5. Strip "pdf" and change "plain" to "tex". +if getline(1) =~ '^%&\s*\k\+' + let b:tex_flavor = matchstr(getline(1), '%&\s*\zs\k\+') +elseif s:GetModelines('\\begin\s*{\s*document\s*}', 1000) != "0:" + let b:tex_flavor = "latex" +elseif exists("g:tex_flavor") + let b:tex_flavor = g:tex_flavor +else + let b:tex_flavor = "latex" +endif +let b:tex_flavor = substitute(b:tex_flavor, 'pdf', '', '') +if b:tex_flavor == "plain" + let b:tex_flavor = "tex" +endif + +" Set 'comments' to format dashed lists in comments +setlocal com=sO:%\ -,mO:%\ \ ,eO:%%,:% + +" Set 'commentstring' to recognize the % comment character: +" (Thanks to Ajit Thakkar.) +setlocal cms=%%s + +" Allow "[d" to be used to find a macro definition: +" Recognize plain TeX \def as well as LaTeX \newcommand and \renewcommand . +" I may as well add the AMS-LaTeX DeclareMathOperator as well. +let &l:define='\\\([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' + \ . 'def\|\\font\|\\\(future\)\=let' + \ . '\|\\new\(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' + \ . '\|fam\|insert\)' + \ . '\|\\\(re\)\=new\(boolean\|command\|counter\|environment\|font' + \ . '\|if\|length\|savebox\|theorem\(style\)\=\)\s*\*\=\s*{\=' + \ . '\|DeclareMathOperator\s*{\=\s*' + +" Tell Vim how to recognize LaTeX \include{foo} and plain \input bar : +setlocal include=\\\\input\\\\|\\\\include{ +setlocal suffixesadd=.tex +" On some file systems, "{" and "}" are inluded in 'isfname'. In case the +" TeX file has \include{fname} (LaTeX only), strip everything except "fname". +let &l:includeexpr = "substitute(v:fname, '^.\\{-}{\\|}.*', '', 'g')" +" fun! TexIncludeExpr() +" let fname = substitute(v:fname, '}.*', '', '') +" return fname +" endfun + +" The following lines enable the macros/matchit.vim plugin for +" extended matching with the % key. +" TODO: Customize this based on b:tex_flavor . +if exists("loaded_matchit") + let b:match_ignorecase = 0 + \ | let b:match_skip = 'r:\\\@<!\%(\\\\\)*%' + \ | let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' . + \ '\\begin\s*\({\a\+\*\=}\):\\end\s*\1' +endif " exists("loaded_matchit") + +let &cpo = s:save_cpo + +" vim:sts=2:sw=2: diff --git a/runtime/ftplugin/vb.vim b/runtime/ftplugin/vb.vim new file mode 100644 index 000000000..bb4c23a2c --- /dev/null +++ b/runtime/ftplugin/vb.vim @@ -0,0 +1,47 @@ +" Vim filetype plugin file +" Language: VisualBasic (ft=vb) +" Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Thu, 22 Nov 2001 12:56:14 W. Europe Standard Time + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal nocindent +setlocal autoindent +setlocal com=sr:'\ -,mb:'\ \ ,el:'\ \ ,:' + +" we need this wrapper, as call doesn't allow a count +fun! <SID>VbSearch(pattern, flags) + let cnt = v:count1 + while cnt > 0 + call search(a:pattern, a:flags) + let cnt = cnt - 1 + endwhile +endfun + +let s:cpo_save = &cpo +set cpo&vim + +" NOTE the double escaping \\| +nnoremap <buffer> <silent> [[ :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'bW')<cr> +nnoremap <buffer> <silent> ]] :call <SID>VbSearch('^\s*\(\(private\|public\)\s\+\)\=\(function\\|sub\)', 'W')<cr> +nnoremap <buffer> <silent> [] :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'bW')<cr> +nnoremap <buffer> <silent> ][ :call <SID>VbSearch('^\s*\<end\>\s\+\(function\\|sub\)', 'W')<cr> + +" matchit support +if exists("loaded_matchit") + let b:match_ignorecase=1 + let b:match_words= + \ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*$:\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' . + \ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' . + \ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' . + \ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' . + \ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' . + \ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' . + \ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' . + \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' . + \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>' +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/verilog.vim b/runtime/ftplugin/verilog.vim new file mode 100644 index 000000000..8a8cfbe6b --- /dev/null +++ b/runtime/ftplugin/verilog.vim @@ -0,0 +1,45 @@ +" Vim filetype plugin file +" Language: Verilog HDL +" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw> +" Last Change: Wed Oct 31 16:16:19 CST 2001 +" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim + +" 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 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croqlm1 + +" Set 'comments' to format dashed lists in comments. +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +" Format comments to be up to 78 characters long +setlocal tw=75 + +set cpo-=C + +" Win32 can filter files in the browse dialog +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Let the matchit plugin know what items can be matched. +if exists("loaded_matchit") + let b:match_ignorecase=0 + let b:match_words= + \ '\<begin\>:\<end\>,' . + \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' . + \ '\<module\>:\<endmodule\>,' . + \ '\<if\>:\<else\>,' . + \ '\<function\>:\<endfunction\>,' . + \ '`ifdef\>:`else\>:`endif\>,' . + \ '\<task\>:\<endtask\>,' . + \ '\<specify\>:\<endspecify\>' +endif diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim new file mode 100644 index 000000000..85e74f3f1 --- /dev/null +++ b/runtime/ftplugin/vim.vim @@ -0,0 +1,61 @@ +" Vim filetype plugin +" Language: Vim +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2004 Feb 20 + +" 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 + +let cpo_save = &cpo +set cpo-=C + +let b:undo_ftplugin = "setl fo< com< tw< commentstring<" + \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" + +" 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 com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" + +" Format comments to be up to 78 characters long +if &tw == 0 + setlocal tw=78 +endif + +" Comments start with a double quote +setlocal commentstring=\"%s + +" Move around functions. +noremap <silent><buffer> [[ :call search('^\s*fu\%[nction]\>', "bW")<CR> +noremap <silent><buffer> ]] :call search('^\s*fu\%[nction]\>', "W")<CR> +noremap <silent><buffer> [] :call search('^\s*endf*\%[unction]\>', "bW")<CR> +noremap <silent><buffer> ][ :call search('^\s*endf*\%[unction]\>', "W")<CR> + +" Move around comments +noremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> +noremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> + +" Let the matchit plugin know what items can be matched. +if exists("loaded_matchit") + let b:match_ignorecase = 0 + let b:match_words = + \ '\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,' . + \ '\<wh\%[ile]\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<endw\%[hile]\>,' . + \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' . + \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' . + \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' . + \ '(:)' + " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif + let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" || + \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' +endif + +let &cpo = cpo_save +setlocal cpo+=M " makes \%( match \) diff --git a/runtime/ftplugin/xhtml.vim b/runtime/ftplugin/xhtml.vim new file mode 100644 index 000000000..8011529c5 --- /dev/null +++ b/runtime/ftplugin/xhtml.vim @@ -0,0 +1,66 @@ +" Vim filetype plugin file +" Language: xhtml +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2004 May 11 +" 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" . + \ "XML Files (*.xml)\t*.xml\n" . + \ "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim +unlet b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +let b:did_ftplugin = 1 + +" Combine the new set of values with those previously included. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter . s:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words . "," . s:match_words +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +" Change the :browse e filter to primarily show tcsh-related files. +if has("gui_win32") + let b:browsefilter=s:browsefilter +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim new file mode 100644 index 000000000..7bde8e724 --- /dev/null +++ b/runtime/ftplugin/xml.vim @@ -0,0 +1,47 @@ +" Vim filetype plugin file +" Language: xml +" 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 +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal commentstring=<!--%s--> + +" XML: thanks to Johannes Zellner and Akbar Ibrahim +" - case sensitive +" - don't match empty tags <fred/> +" - match <!--, --> style comments (but not --, --) +" - match <!, > inlined dtd's. This is not perfect, as it +" gets confused for example by +" <!ENTITY gt ">"> +if exists("loaded_matchit") + let b:match_ignorecase=0 + let b:match_words = + \ '<:>,' . + \ '<\@<=!\[CDATA\[:]]>,'. + \ '<\@<=!--:-->,'. + \ '<\@<=?\k\+:?>,'. + \ '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'. + \ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' +endif + +" Change the :browse e filter to primarily show xml-related files. +if has("gui_win32") + let b:browsefilter="XML Files (*.xml)\t*.xml\n" . + \ "DTD Files (*.dtd)\t*.dtd\n" . + \ "All Files (*.*)\t*.*\n" +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms<" . + \ " | unlet! b:match_ignorecase b:match_words b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo diff --git a/runtime/ftplugin/xs.vim b/runtime/ftplugin/xs.vim new file mode 100644 index 000000000..cf3318258 --- /dev/null +++ b/runtime/ftplugin/xs.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: XS (Perl extension interface language) +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2001 Sep 18 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Just use the C plugin for now. +runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim diff --git a/runtime/ftplugin/xsd.vim b/runtime/ftplugin/xsd.vim new file mode 100644 index 000000000..1cd7adc76 --- /dev/null +++ b/runtime/ftplugin/xsd.vim @@ -0,0 +1,38 @@ +" Vim filetype plugin file +" Language: xsd +" 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 xsd-related files. +if has("gui_win32") + let b:browsefilter="XSD Files (*.xsd)\t*.xsd\n" . s:browsefilter +endif + +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/xslt.vim b/runtime/ftplugin/xslt.vim new file mode 100644 index 000000000..a4b80a614 --- /dev/null +++ b/runtime/ftplugin/xslt.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: xslt +" Maintainer: Dan Sharp <dwsharp at hotmail dot com> +" Last Changed: 2002 Nov 26 +" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin + +if exists("b:did_ftplugin") | finish | endif + +runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim + +let b:did_ftplugin = 1 + +" Change the :browse e filter to primarily show xsd-related files. +if has("gui_win32") && exists("b:browsefilter") + let b:browsefilter="XSLT Files (*.xsl,*.xslt)\t*.xsl,*.xslt\n" . b:browsefilter +endif |