summaryrefslogtreecommitdiff
path: root/runtime/ftplugin
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-05-05 17:54:07 +0000
committerBram Moolenaar <Bram@vim.org>2007-05-05 17:54:07 +0000
commit9964e468c0209f6b8286e0b08109817c845a3079 (patch)
tree3c53288cff0d4c2e32169d8eb4cd53cc343ad0bc /runtime/ftplugin
parentd5ab34bd5ecc748d5502f149c476968e5ec2b7c9 (diff)
downloadvim-9964e468c0209f6b8286e0b08109817c845a3079.zip
updated for version 7.1a
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r--runtime/ftplugin/ada.vim357
-rw-r--r--runtime/ftplugin/bst.vim15
-rw-r--r--runtime/ftplugin/cobol.vim266
-rw-r--r--runtime/ftplugin/debchangelog.vim27
-rw-r--r--runtime/ftplugin/hamster.vim61
-rw-r--r--runtime/ftplugin/haskell.vim2
-rw-r--r--runtime/ftplugin/mail.vim5
-rw-r--r--runtime/ftplugin/make.vim4
-rw-r--r--runtime/ftplugin/ocaml.vim8
9 files changed, 530 insertions, 215 deletions
diff --git a/runtime/ftplugin/ada.vim b/runtime/ftplugin/ada.vim
index 13fa8f93f..688cf97f7 100644
--- a/runtime/ftplugin/ada.vim
+++ b/runtime/ftplugin/ada.vim
@@ -1,223 +1,190 @@
-" Vim Ada plugin file
-" Language: Ada
-" Maintainer: Neil Bird <neil@fnxweb.com>
-" Last Change: 2006 Apr 21
-" Version: $Id$
-" Look for the latest version at http://vim.sourceforge.net/
-"
-" Perform Ada specific completion & tagging.
-"
-"
+"------------------------------------------------------------------------------
+" Description: Perform Ada specific completion & tagging.
+" Language: Ada (2005)
+" $Id$
+" Maintainer: Martin Krischik
+" Neil Bird <neil@fnxweb.com>
+" $Author$
+" $Date$
+" Version: 4.2
+" $Revision$
+" $HeadURL: https://svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/ftplugin/ada.vim $
+" History: 24.05.2006 MK Unified Headers
+" 26.05.2006 MK ' should not be in iskeyword.
+" 16.07.2006 MK Ada-Mode as vim-ball
+" 02.10.2006 MK Better folding.
+" 15.10.2006 MK Bram's suggestion for runtime integration
+" 05.11.2006 MK Bram suggested not to use include protection for
+" autoload
+" 05.11.2006 MK Bram suggested to save on spaces
+" Help Page: ft-ada-plugin
+"------------------------------------------------------------------------------
" 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
+if exists ("b:did_ftplugin") || version < 700
+ finish
endif
" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
+let b:did_ftplugin = 38
+"
" Temporarily set cpoptions to ensure the script loads OK
+"
let s:cpoptions = &cpoptions
-set cpo-=C
+set cpoptions-=C
-" Ada comments
-setlocal comments+=O:--
+" Section: Comments {{{1
+"
+setlocal comments=O:--,:--\ \
+setlocal commentstring=--\ \ %s
+setlocal complete=.,w,b,u,t,i
-" 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>
+" Section: Tagging {{{1
+"
+if exists ("g:ada_extended_tagging")
+ " Make local tag mappings for this buffer (if not already set)
+ if g:ada_extended_tagging == 'jump'
+ if mapcheck('<C-]>','n') == ''
+ nnoremap <unique> <buffer> <C-]> :call ada#Jump_Tag ('', 'tjump')<cr>
+ endif
+ if mapcheck('g<C-]>','n') == ''
+ nnoremap <unique> <buffer> g<C-]> :call ada#Jump_Tag ('','stjump')<cr>
+ endif
+ elseif g:ada_extended_tagging == 'list'
+ if mapcheck('<C-]>','n') == ''
+ nnoremap <unique> <buffer> <C-]> :call ada#List_Tag ()<cr>
+ endif
+ if mapcheck('g<C-]>','n') == ''
+ nnoremap <unique> <buffer> g<C-]> :call ada#List_Tag ()<cr>
+ endif
+ endif
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>
+" Section: Completion {{{1
+"
+setlocal completefunc=ada#User_Complete
+setlocal omnifunc=adacomplete#Complete
+
+if exists ("g:ada_extended_completion")
+ if mapcheck ('<C-N>','i') == ''
+ inoremap <unique> <buffer> <C-N> <C-R>=ada#Completion("\<lt>C-N>")<cr>
+ endif
+ if mapcheck ('<C-P>','i') == ''
+ inoremap <unique> <buffer> <C-P> <C-R>=ada#Completion("\<lt>C-P>")<cr>
+ endif
+ if mapcheck ('<C-X><C-]>','i') == ''
+ inoremap <unique> <buffer> <C-X><C-]> <C-R>=<SID>ada#Completion("\<lt>C-X>\<lt>C-]>")<cr>
+ endif
+ if mapcheck ('<bs>','i') == ''
+ inoremap <silent> <unique> <buffer> <bs> <C-R>=ada#Insert_Backspace ()<cr>
+ endif
endif
-
+" Section: Matchit {{{1
+"
" 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\>'
+"
+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
+" Section: Compiler {{{1
+"
+if ! exists("current_compiler") ||
+ \ current_compiler != g:ada_default_compiler
+ execute "compiler " . g:ada_default_compiler
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
+" Section: Folding {{{1
+"
+if exists("g:ada_folding")
+ if g:ada_folding[0] == 'i'
+ setlocal foldmethod=indent
+ setlocal foldignore=--
+ setlocal foldnestmax=5
+ elseif g:ada_folding[0] == 'g'
+ setlocal foldmethod=expr
+ setlocal foldexpr=ada#Pretty_Print_Folding(v:lnum)
+ elseif g:ada_folding[0] == 's'
+ setlocal foldmethod=syntax
+ endif
+ setlocal tabstop=8
+ setlocal softtabstop=3
+ setlocal shiftwidth=3
+endif
+" Section: Abbrev {{{1
+"
+if exists("g:ada_abbrev")
+ iabbrev ret return
+ iabbrev proc procedure
+ iabbrev pack package
+ iabbrev func function
+endif
+" Section: Commands, Mapping, Menus {{{1
+"
+call ada#Map_Popup (
+ \ 'Tag.List',
+ \ 'l',
+ \ 'call ada#List_Tag ()')
+call ada#Map_Popup (
+ \'Tag.Jump',
+ \'j',
+ \'call ada#Jump_Tag ()')
+call ada#Map_Menu (
+ \'Tag.Create File',
+ \':AdaTagFile',
+ \'call ada#Create_Tags (''file'')')
+call ada#Map_Menu (
+ \'Tag.Create Dir',
+ \':AdaTagDir',
+ \'call ada#Create_Tags (''dir'')')
+
+call ada#Map_Menu (
+ \'Highlight.Toggle Space Errors',
+ \ ':AdaSpaces',
+ \'call ada#Switch_Syntax_Option (''space_errors'')')
+call ada#Map_Menu (
+ \'Highlight.Toggle Lines Errors',
+ \ ':AdaLines',
+ \'call ada#Switch_Syntax_Option (''line_errors'')')
+call ada#Map_Menu (
+ \'Highlight.Toggle Rainbow Color',
+ \ ':AdaRainbow',
+ \'call ada#Switch_Syntax_Option (''rainbow_color'')')
+call ada#Map_Menu (
+ \'Highlight.Toggle Standard Types',
+ \ ':AdaTypes',
+ \'call ada#Switch_Syntax_Option (''standard_types'')')
+
+" 1}}}
" Reset cpoptions
let &cpoptions = s:cpoptions
unlet s:cpoptions
-" vim: sts=2 sw=2 :
+finish " 1}}}
+
+"------------------------------------------------------------------------------
+" Copyright (C) 2006 Martin Krischik
+"
+" Vim is Charityware - see ":help license" or uganda.txt for licence details.
+"------------------------------------------------------------------------------
+" vim: textwidth=78 nowrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
+" vim: foldmethod=marker
diff --git a/runtime/ftplugin/bst.vim b/runtime/ftplugin/bst.vim
new file mode 100644
index 000000000..973e342b9
--- /dev/null
+++ b/runtime/ftplugin/bst.vim
@@ -0,0 +1,15 @@
+" Vim filetype plugin file
+" Language: bst
+" Author: Tim Pope <vimNOSPAM@tpope.info>
+" $Id$
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=%\ %s
+setlocal comments=:%
+setlocal fo-=t fo+=croql
+
+let b:undo_ftplugin = "setlocal com< cms< fo<"
diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim
new file mode 100644
index 000000000..443ea68d2
--- /dev/null
+++ b/runtime/ftplugin/cobol.vim
@@ -0,0 +1,266 @@
+" Vim filetype plugin file
+" Language: cobol
+" Author: Tim Pope <vimNOSPAM@tpope.info>
+" $Id$
+
+" Insert mode mappings: <C-T> <C-D> <Tab>
+" Normal mode mappings: < > << >> [[ ]] [] ][
+" Visual mode mappings: < >
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal commentstring=\ \ \ \ \ \ *%s
+setlocal comments=:*
+setlocal fo+=croqlt
+setlocal expandtab
+setlocal textwidth=72
+
+" matchit support
+if exists("loaded_matchit")
+ let s:ordot = '\|\ze\.\%( \@=\|$\)'
+ let b:match_ignorecase=1
+ "let b:match_skip = 'getline(".") =~ "^.\\{6\\}[*/C]"'
+ let b:match_words=
+ \ '\$if\>:$else\>:\$endif\>,' .
+ \ '[$-]\@<!\<if\>:\<\%(then\|else\)\>:\<end-if\>'.s:ordot.',' .
+ \ '-\@<!\<perform\s\+\%(\d\+\s\+times\|until\|varying\|with\s\+test\)\>:\<end-perform\>'.s:ordot . ',' .
+ \ '-\@<!\<\%(search\|evaluate\)\>:\<\%(when\)\>:\<end-\%(search\|evaluate\)\>' .s:ordot . ',' .
+ \ '-\@<!\<\%(add\|compute\|divide\|multiply\|subtract\)\>\%(.*\(\%$\|\%(\n\%(\%(\s*\|.\{6\}\)[*/].*\n\)*\)\=\s*\%(not\s\+\)\=on\s\+size\s\+error\>\)\)\@=:\%(\<not\s\+\)\@<!\<\%(not\s\+\)\=on\s\+size\s\+error\>:\<end-\%(add\|compute\|divide\|multiply\|subtract\)\>' .s:ordot . ',' .
+ \ '-\@<!\<\%(string\|unstring\|accept\|display\|call\)\>\%(.*\(\%$\|\%(\n\%(\%(\s*\|.\{6\}\)[*/].*\n\)*\)\=\s*\%(not\s\+\)\=on\s\+\%(overflow\|exception\)\>\)\)\@=:\%(\<not\s\+\)\@<!\<\%(not\s\+\)\=on\s\+\%(overflow\|exception\)\>:\<end-\%(string\|unstring\|accept\|display\|call\)\>' .s:ordot . ',' .
+ \ '-\@<!\<\%(delete\|rewrite\|start\|write\|read\)\>\%(.*\(\%$\|\%(\n\%(\%(\s*\|.\{6\}\)[*/].*\n\)*\)\=\s*\%(invalid\s\+key\|at\s\+end\|no\s\+data\|at\s\+end-of-page\)\>\)\)\@=:\%(\<not\s\+\)\@<!\<\%(not\s\+\)\=\%(invalid\s\+key\|at\s\+end\|no\s\+data\|at\s\+end-of-page\)\>:\<end-\%(delete\|rewrite\|start\|write\|read\)\>' .s:ordot
+endif
+
+if has("gui_win32") && !exists("b:browsefilter")
+ let b:browsefilter = "COBOL Source Files (*.cbl, *.cob)\t*.cbl;*.cob;*.lib\n".
+ \ "All Files (*.*)\t*.*\n"
+endif
+
+let b:undo_ftplugin = "setlocal com< cms< fo< et< tw<" .
+ \ " | unlet! b:browsefilter b:match_words b:match_ignorecase b:match_skip"
+if !exists("g:no_plugin_maps") && !exists("g:no_cobol_maps")
+ let b:undo_ftplugin = b:undo_ftplugin .
+ \ " | sil! exe 'nunmap <buffer> <'" .
+ \ " | sil! exe 'nunmap <buffer> >'" .
+ \ " | sil! exe 'nunmap <buffer> <<'" .
+ \ " | sil! exe 'nunmap <buffer> >>'" .
+ \ " | sil! exe 'vunmap <buffer> <'" .
+ \ " | sil! exe 'vunmap <buffer> >'" .
+ \ " | sil! exe 'iunmap <buffer> <C-D>'" .
+ \ " | sil! exe 'iunmap <buffer> <C-T>'" .
+ \ " | sil! exe 'iunmap <buffer> <Tab>'" .
+ \ " | sil! exe 'nunmap <buffer> <Plug>Traditional'" .
+ \ " | sil! exe 'nunmap <buffer> <Plug>Comment'" .
+ \ " | sil! exe 'nunmap <buffer> <Plug>DeComment'" .
+ \ " | sil! exe 'vunmap <buffer> <Plug>VisualTraditional'" .
+ \ " | sil! exe 'vunmap <buffer> <Plug>VisualComment'" .
+ \ " | sil! exe 'iunmap <buffer> <Plug>VisualDeComment'" .
+ \ " | sil! exe 'unmap <buffer> [['" .
+ \ " | sil! exe 'unmap <buffer> ]]'" .
+ \ " | sil! exe 'unmap <buffer> []'" .
+ \ " | sil! exe 'unmap <buffer> ]['"
+endif
+
+if !exists("g:no_plugin_maps") && !exists("g:no_cobol_maps")
+ if version >= 700
+ nnoremap <silent> <buffer> > :set opfunc=<SID>IncreaseFunc<CR>g@
+ nnoremap <silent> <buffer> < :set opfunc=<SID>DecreaseFunc<CR>g@
+ endif
+ nnoremap <silent> <buffer> >> :call CobolIndentBlock(1)<CR>
+ nnoremap <silent> <buffer> << :call CobolIndentBlock(-1)<CR>
+ vnoremap <silent> <buffer> > :call CobolIndentBlock(v:count1)<CR>
+ vnoremap <silent> <buffer> < :call CobolIndentBlock(-v:count1)<CR>
+ inoremap <silent> <buffer> <C-T> <C-R>=<SID>IncreaseIndent()<CR><C-R>=<SID>RestoreShiftwidth()<CR>
+ inoremap <silent> <buffer> <C-D> <C-R>=<SID>DecreaseIndent()<CR><C-R>=<SID>RestoreShiftwidth()<CR>
+ if !maparg("<Tab>","i")
+ inoremap <silent> <buffer> <Tab> <C-R>=<SID>Tab()<CR><C-R>=<SID>RestoreShiftwidth()<CR>
+ endif
+ noremap <silent> <buffer> [[ m':call search('\c^\%(\s*\<Bar>.\{6\}\s\+\)\zs[A-Za-z0-9-]\+\s\+\%(division\<Bar>section\)\s*\.','bW')<CR>
+ noremap <silent> <buffer> ]] m':call search('\c^\%(\s*\<Bar>.\{6\}\s\+\)\zs[A-Za-z0-9-]\+\s\+\%(division\<Bar>section\)\.','W')<CR>
+ noremap <silent> <buffer> [] m':call <SID>toend('b')<CR>
+ noremap <silent> <buffer> ][ m':call <SID>toend('')<CR>
+ " For EnhancedCommentify
+ noremap <silent> <buffer> <Plug>Traditional :call <SID>Comment('t')<CR>
+ noremap <silent> <buffer> <Plug>Comment :call <SID>Comment('c')<CR>
+ noremap <silent> <buffer> <Plug>DeComment :call <SID>Comment('u')<CR>
+ noremap <silent> <buffer> <Plug>VisualTraditional :'<,'>call <SID>Comment('t')<CR>
+ noremap <silent> <buffer> <Plug>VisualComment :'<,'>call <SID>Comment('c')<CR>
+ noremap <silent> <buffer> <Plug>VisualDeComment :'<,'>call <SID>Comment('u')<CR>
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+if exists("g:did_cobol_ftplugin_functions")
+ finish
+endif
+let g:did_cobol_ftplugin_functions = 1
+
+function! s:repeat(str,count)
+ let i = 0
+ let ret = ""
+ while i < a:count
+ let ret = ret . a:str
+ let i = i + 1
+ endwhile
+ return ret
+endfunction
+
+function! s:increase(...)
+ let lnum = '.'
+ let sw = &shiftwidth
+ let i = a:0 ? a:1 : indent(lnum)
+ if i >= 11
+ return sw - (i - 11) % sw
+ elseif i >= 7
+ return 11-i
+ elseif i == 6
+ return 1
+ else
+ return 6-i
+ endif
+endfunction
+
+function! s:decrease(...)
+ let lnum = '.'
+ let sw = &shiftwidth
+ let i = indent(a:0 ? a:1 : lnum)
+ if i >= 11 + sw
+ return 1 + (i + 12) % sw
+ elseif i > 11
+ return i-11
+ elseif i > 7
+ return i-7
+ elseif i == 7
+ return 1
+ else
+ return i
+ endif
+endfunction
+
+function! CobolIndentBlock(shift)
+ let head = strpart(getline('.'),0,7)
+ let tail = strpart(getline('.'),7)
+ let indent = match(tail,'[^ ]')
+ let sw = &shiftwidth
+ let shift = a:shift
+ if shift > 0
+ if indent < 4
+ let tail = s:repeat(" ",4-indent).tail
+ let shift = shift - 1
+ endif
+ let tail = s:repeat(" ",shift*sw).tail
+ let shift = 0
+ elseif shift < 0
+ if (indent-4) > -shift * sw
+ let tail = strpart(tail,-shift * sw)
+ elseif (indent-4) > (-shift-1) * sw
+ let tail = strpart(tail,indent - 4)
+ else
+ let tail = strpart(tail,indent)
+ endif
+ endif
+ call setline('.',head.tail)
+endfunction
+
+function! s:IncreaseFunc(type)
+ '[,']call CobolIndentBlock(1)
+endfunction
+
+function! s:DecreaseFunc(type)
+ '[,']call CobolIndentBlock(-1)
+endfunction
+
+function! s:IncreaseIndent()
+ let c = "\<C-T>"
+ if exists("*InsertCtrlTWrapper")
+ let key = InsertCtrlTWrapper()
+ if key != c
+ return key
+ endif
+ endif
+ let interval = s:increase()
+ let b:cobol_shiftwidth = &shiftwidth
+ let &shiftwidth = 1
+ let lastchar = strpart(getline('.'),col('.')-2,1)
+ if lastchar == '0' || lastchar == '^'
+ return "\<BS>".lastchar.c
+ else
+ return s:repeat(c,interval)
+ endif
+endfunction
+
+function! s:DecreaseIndent()
+ let c = "\<C-D>"
+ if exists("*InsertCtrlDWrapper")
+ " I hack Ctrl-D to delete when not at the end of the line.
+ let key = InsertCtrlDWrapper()
+ if key != c
+ return key
+ endif
+ endif
+ let interval = s:decrease()
+ let b:cobol_shiftwidth = &shiftwidth
+ let &shiftwidth = 1
+ return s:repeat(c,interval)
+endfunction
+
+function! s:RestoreShiftwidth()
+ if exists("b:cobol_shiftwidth")
+ let &shiftwidth=b:cobol_shiftwidth
+ unlet b:cobol_shiftwidth
+ endif
+ return ""
+endfunction
+
+function! s:Tab()
+ if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
+ return s:IncreaseIndent()
+ elseif &sts == &sw && &sts != 8 && &et
+ return s:repeat(" ",s:increase(col('.')-1))
+ else
+ return "\<Tab>"
+ endif
+endfunction
+
+function! s:Comment(arg)
+ " For EnhancedCommentify
+ let line = getline('.')
+ if (line =~ '^.\{6\}[*/C]' || a:arg == 'c') && a:arg != 'u'
+ let line = substitute(line,'^.\{6\}\zs.',' ','')
+ else
+ let line = substitute(line,'^.\{6\}\zs.','*','')
+ endif
+ call setline('.',line)
+endfunction
+
+function! s:toend(direction)
+ let ignore = '^\(\s*\|.\{6\}\)\%([*/]\|\s*$\)'
+ let keep = line('.')
+ keepjumps +
+ while line('.') < line('$') && getline('.') =~ ignore
+ keepjumps +
+ endwhile
+ let res = search('\c^\%(\s*\|.\{6\}\s\+\)\zs[A-Za-z0-9-]\+\s\+\%(division\|section\)\s*\.',a:direction.'W')
+ if a:direction != 'b' && !res
+ let res = line('$')
+ keepjumps $
+ elseif res
+ keepjumps -
+ endif
+ if res
+ while line('.') > 1 && getline('.') =~ ignore
+ keepjumps -
+ endwhile
+ if line('.') == 1 && getline('.') =~ ignore
+ exe "keepjumps ".keep
+ endif
+ else
+ exe "keepjumps ".keep
+ endif
+endfunction
diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim
index 167f56c73..a3079d198 100644
--- a/runtime/ftplugin/debchangelog.vim
+++ b/runtime/ftplugin/debchangelog.vim
@@ -2,14 +2,14 @@
" Language: Debian Changelog
" Maintainer: Michael Piefel <piefel@informatik.hu-berlin.de>
" Stefano Zacchiroli <zack@debian.org>
-" Last Change: $LastChangedDate: 2006-04-28 12:15:12 -0400 (ven, 28 apr 2006) $
+" Last Change: $LastChangedDate: 2006-08-24 23:41:26 +0200 (gio, 24 ago 2006) $
" License: GNU GPL, version 2.0 or later
" URL: http://svn.debian.org/wsvn/pkg-vim/trunk/runtime/ftplugin/debchangelog.vim?op=file&rev=0&sc=0
if exists("b:did_ftplugin")
finish
endif
-let b:did_ftplugin = 1
+let b:did_ftplugin=1
" {{{1 Local settings (do on every load)
setlocal foldmethod=expr
@@ -227,21 +227,22 @@ augroup END
" }}}
" {{{1 folding
-" look for an author name searching backward from a given line number
-function! s:getAuthor(lnum)
- let line = getline(a:lnum)
- let backsteps = 0
- while line !~ '^ --'
- let backsteps += 1
- let line = getline(a:lnum - backsteps)
+" look for an author name in the [zonestart zoneend] lines searching backward
+function! s:getAuthor(zonestart, zoneend)
+ let linepos = a:zoneend
+ while linepos >= a:zonestart
+ let line = getline(linepos)
+ if line =~ '^ --'
+ return substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '')
+ endif
+ let linepos -= 1
endwhile
- let author = substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '')
- return author
+ return '[unknown]'
endfunction
function! DebChangelogFoldText()
if v:folddashes == '-' " changelog entry fold
- return foldtext() . ' -- ' . s:getAuthor(v:foldend) . ' '
+ return foldtext() . ' -- ' . s:getAuthor(v:foldstart, v:foldend) . ' '
endif
return foldtext()
endfunction
@@ -260,6 +261,8 @@ function! GetDebChangelogFold(lnum)
return '='
endfunction
+foldopen! " unfold the entry the cursor is on (usually the first one)
+
" }}}
" vim: set foldmethod=marker:
diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim
new file mode 100644
index 000000000..ddb40f928
--- /dev/null
+++ b/runtime/ftplugin/hamster.vim
@@ -0,0 +1,61 @@
+" Vim filetype plugin
+" Language: Hamster Script
+" Version: 2.0.6.0
+" Maintainer: David Fishburn <fishburn@ianywhere.com>
+" Last Change: Wed Nov 08 2006 12:03:09 PM
+
+" 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
+
+" Use the # sign for comments
+setlocal comments=:#
+
+" 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*sub\>', "bW")<CR>
+noremap <silent><buffer> ]] :call search('^\s*sub\>', "W")<CR>
+noremap <silent><buffer> [] :call search('^\s*endsub\>', "bW")<CR>
+noremap <silent><buffer> ][ :call search('^\s*endsub\>', "W")<CR>
+
+" Move around comments
+noremap <silent><buffer> ]# :call search('^\s*#\@!', "W")<CR>
+noremap <silent><buffer> [# :call search('^\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 =
+ \ '\<sub\>:\<return\>:\<endsub\>,' .
+ \ '\<do\|while\|repeat\|for\>:\<break\>:\<continue\>:\<loop\|endwhile\|until\|endfor\>,' .
+ \ '\<if\>:\<else\%[if]\>:\<endif\>'
+
+ " 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
+
+setlocal ignorecase
+let &cpo = cpo_save
+setlocal cpo+=M " makes \%( match \)
diff --git a/runtime/ftplugin/haskell.vim b/runtime/ftplugin/haskell.vim
index a16dadb00..f5a3a807a 100644
--- a/runtime/ftplugin/haskell.vim
+++ b/runtime/ftplugin/haskell.vim
@@ -8,7 +8,7 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
-let b:undo_plugin = "setl com< cms< fo<"
+let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=s1fl:{-,mb:-,ex:-},:-- commentstring=--\ %s
setlocal formatoptions-=t formatoptions+=croql
diff --git a/runtime/ftplugin/mail.vim b/runtime/ftplugin/mail.vim
index 16bf19758..34e1d3c22 100644
--- a/runtime/ftplugin/mail.vim
+++ b/runtime/ftplugin/mail.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Mail
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2004 Feb 20
+" Last Change: 2007 Apr 30
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -11,7 +11,8 @@ let b:did_ftplugin = 1
let b:undo_ftplugin = "setl modeline< tw< fo<"
-" Don't use modelines in e-mail messages, avoid trojan horses
+" Don't use modelines in e-mail messages, avoid trojan horses and nasty
+" "jokes" (e.g., setting 'textwidth' to 5).
setlocal nomodeline
" many people recommend keeping e-mail messages 72 chars wide
diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim
index a947be1ad..38ee030f5 100644
--- a/runtime/ftplugin/make.vim
+++ b/runtime/ftplugin/make.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Make
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2004 Dec 17
+" Last Change: 2006 Jun 17
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -9,7 +9,7 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
-let b:undo_ftplugin = "setl et< fo< com< commentstring<"
+let b:undo_ftplugin = "setl et< sts< fo< com< cms< inc<"
" Make sure a hard tab is used, required for most make programs
setlocal noexpandtab softtabstop=0
diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim
index 0b9819a9b..10ead8a1e 100644
--- a/runtime/ftplugin/ocaml.vim
+++ b/runtime/ftplugin/ocaml.vim
@@ -4,7 +4,8 @@
" Markus Mottl <markus.mottl@gmail.com>
" Stefano Zacchiroli <zack@bononia.it>
" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim
-" Last Change: 2006 Apr 11 - Fixed an initialization bug; fixed ASS abbrev (MM)
+" Last Change: 2006 May 01 - Added .annot support for file.whateverext (SZ)
+" 2006 Apr 11 - Fixed an initialization bug; fixed ASS abbrev (MM)
" 2005 Oct 13 - removed GPL; better matchit support (MM, SZ)
"
if exists("b:did_ftplugin")
@@ -202,6 +203,7 @@ python << EOF
import re
import os
+import os.path
import string
import time
import vim
@@ -288,13 +290,13 @@ class Annotations:
line = f.readline() # position line
f.close()
self.__filename = fname
- self.__ml_filename = re.sub("\.annot$", ".ml", fname)
+ self.__ml_filename = vim.current.buffer.name
self.__timestamp = int(time.time())
except IOError:
raise no_annotations
def parse(self):
- annot_file = re.sub("\.ml$", ".annot", vim.current.buffer.name)
+ annot_file = os.path.splitext(vim.current.buffer.name)[0] + ".annot"
self.__parse(annot_file)
def get_type(self, (line1, col1), (line2, col2)):