diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-27 00:02:13 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-27 00:02:13 +0000 |
commit | f193fffd16563cfbe7c02a21e19c8bb11707581d (patch) | |
tree | 4bae3092421aa986103b8000b1012989a9ea49e6 /runtime/ftplugin | |
parent | 551dbcc9b604c2992f908fb475e797fcc116315b (diff) |
updated for version 7.0f02v7.0f02
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/debchangelog.vim | 52 | ||||
-rw-r--r-- | runtime/ftplugin/html.vim | 11 | ||||
-rw-r--r-- | runtime/ftplugin/sql.vim | 51 |
3 files changed, 90 insertions, 24 deletions
diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index 59f601ad01..6d1f20ee3d 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -1,7 +1,9 @@ -" Vim filetype plugin file +" Vim filetype plugin file (GUI menu and folding) " Language: Debian Changelog " Maintainer: Michael Piefel <piefel@informatik.hu-berlin.de> -" Last Change: 15 August 2005 +" Stefano Zacchiroli <zack@debian.org> +" Last Change: 25 April 2006 +" License: GNU GPL, version 2.1 or later if exists("g:did_changelog_ftplugin") finish @@ -10,6 +12,8 @@ endif " Don't load another plugin (this is global) let g:did_changelog_ftplugin = 1 +" {{{1 GUI menu + " Helper functions returning various data. " Returns full name, either from $DEBFULLNAME or debianfullname. " TODO Is there a way to determine name from anywhere else? @@ -204,3 +208,47 @@ augroup END setlocal tw=78 setlocal comments=f:* let b:undo_ftplugin = "setlocal tw< comments<" + +" }}} +" {{{1 folding + +setlocal foldmethod=expr +set foldexpr=GetDebChangelogFold(v:lnum) +setlocal foldtext=DebChangelogFoldText() + +" 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) + endwhile + let author = substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '') + return author +endfunction + +function! DebChangelogFoldText() + if v:folddashes == '-' " changelog entry fold + return foldtext() . ' -- ' . s:getAuthor(v:foldend) . ' ' + endif + return foldtext() +endfunction + +function! GetDebChangelogFold(lnum) + let line = getline(a:lnum) + if line =~ '^\w\+' + return '>1' " beginning of a changelog entry + endif + if line =~ '^\s\+\[.*\]' + return '>2' " beginning of an author-specific chunk + endif + if line =~ '^ --' + return '1' + endif + return '=' +endfunction + +" }}} + +" vim: set foldmethod=marker: diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim index 484651faf9..3d723315df 100644 --- a/runtime/ftplugin/html.vim +++ b/runtime/ftplugin/html.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: html " Maintainer: Dan Sharp <dwsharp at hotmail dot com> -" Last Changed: 2004 Jul 08 +" Last Changed: 2006 Apr 26 " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin if exists("b:did_ftplugin") | finish | endif @@ -14,16 +14,17 @@ set cpo-=C setlocal commentstring=<!--%s--> +if exists('&omnifunc') +" Distinguish between HTML versions +" To use with other HTML versions add another +" elseif condition to match proper DOCTYPE setlocal omnifunc=htmlcomplete#CompleteTags -" This part added as suggestion by Mikolaj Machowski, still be approved by Dan -" Sharp! if &filetype == 'xhtml' let b:html_omni_flavor = 'xhtml10s' else let b:html_omni_flavor = 'html401t' endif - let i = 1 while i < 10 && i < line("$") let line = getline(i) @@ -63,7 +64,7 @@ while i < 10 && i < line("$") endif let i += 1 endwhile - +endif " HTML: thanks to Johannes Zellner and Benji Fisher. if exists("loaded_matchit") diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 1bc58318c6..c9924b73dc 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 1.0 +" Version: 3.0 " Maintainer: David Fishburn <fishburn at ianywhere dot com> -" Last Change: Tue Mar 28 2006 2:26:48 PM +" Last Change: Wed Apr 26 2006 3:02:32 PM " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -360,6 +360,11 @@ setlocal comments=s1:/*,mb:*,ex:*/,:--,:// " Set completion with CTRL-X CTRL-O to autoloaded function. if exists('&omnifunc') + " Since the SQL completion plugin can be used in conjunction + " with other completion filetypes it must record the previous + " OMNI function prior to setting up the SQL OMNI function + let b:sql_compl_savefunc = &omnifunc + " This is used by the sqlcomplete.vim plugin " Source it for it's global functions runtime autoload/syntaxcomplete.vim @@ -370,28 +375,40 @@ if exists('&omnifunc') if !exists('g:omni_sql_no_default_maps') " Static maps which use populate the completion list " using Vim's syntax highlighting rules - imap <buffer> <c-c>a <C-\><C-O>:let b:sql_compl_type='syntax'<CR><C-X><C-O> - imap <buffer> <c-c>k <C-\><C-O>:let b:sql_compl_type='sqlKeyword'<CR><C-X><C-O> - imap <buffer> <c-c>f <C-\><C-O>:let b:sql_compl_type='sqlFunction'<CR><C-X><C-O> - imap <buffer> <c-c>o <C-\><C-O>:let b:sql_compl_type='sqlOption'<CR><C-X><C-O> - imap <buffer> <c-c>T <C-\><C-O>:let b:sql_compl_type='sqlType'<CR><C-X><C-O> - imap <buffer> <c-c>s <C-\><C-O>:let b:sql_compl_type='sqlStatement'<CR><C-X><C-O> + imap <buffer> <c-c>a <C-\><C-O>:call sqlcomplete#Map('syntax')<CR><C-X><C-O> + imap <buffer> <c-c>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O> + imap <buffer> <c-c>f <C-\><C-O>:call sqlcomplete#Map('sqlFunction')<CR><C-X><C-O> + imap <buffer> <c-c>o <C-\><C-O>:call sqlcomplete#Map('sqlOption')<CR><C-X><C-O> + imap <buffer> <c-c>T <C-\><C-O>:call sqlcomplete#Map('sqlType')<CR><C-X><C-O> + imap <buffer> <c-c>s <C-\><C-O>:call sqlcomplete#Map('sqlStatement')<CR><C-X><C-O> " Dynamic maps which use populate the completion list " using the dbext.vim plugin - imap <buffer> <c-c>t <C-\><C-O>:let b:sql_compl_type='table'<CR><C-X><C-O> - imap <buffer> <c-c>p <C-\><C-O>:let b:sql_compl_type='procedure'<CR><C-X><C-O> - imap <buffer> <c-c>v <C-\><C-O>:let b:sql_compl_type='view'<CR><C-X><C-O> - imap <buffer> <c-c>c <C-\><C-O>:let b:sql_compl_type='column'<CR><C-X><C-O> - imap <buffer> <c-c>l <C-\><C-O>:let b:sql_compl_type='column_csv'<CR><C-X><C-O> + imap <buffer> <c-c>t <C-\><C-O>:call sqlcomplete#Map('table')<CR><C-X><C-O> + imap <buffer> <c-c>p <C-\><C-O>:call sqlcomplete#Map('procedure')<CR><C-X><C-O> + imap <buffer> <c-c>v <C-\><C-O>:call sqlcomplete#Map('view')<CR><C-X><C-O> + imap <buffer> <c-c>c <C-\><C-O>:call sqlcomplete#Map('column')<CR><C-X><C-O> + imap <buffer> <c-c>l <C-\><C-O>:call sqlcomplete#Map('column_csv')<CR><C-X><C-O> " The next 3 maps are only to be used while the completion window is " active due to the <CR> at the beginning of the map - imap <buffer> <c-c>L <CR><C-\><C-O>:let b:sql_compl_type='column_csv'<CR><C-X><C-O> + imap <buffer> <c-c>L <C-Y><C-\><C-O>:call sqlcomplete#Map('column_csv')<CR><C-X><C-O> + " <C-Right> is not recognized on most Unix systems, so only create + " these additional maps on the Windows platform. + " If you would like to use these maps, choose a different key and make + " the same map in your vimrc. if has('win32') - imap <buffer> <c-right> <CR><C-\><C-O>:let b:sql_compl_type='column'<CR><C-X><C-O> - imap <buffer> <c-left> <C-\><C-O>:let b:sql_compl_type='tableReset'<CR><C-X><C-O> + imap <buffer> <c-right> <C-R>=sqlcomplete#DrillIntoTable()<CR> + imap <buffer> <c-left> <C-R>=sqlcomplete#DrillOutOfColumns()<CR> endif " Remove any cached items useful for schema changes - imap <buffer> <c-c>R <C-\><C-O>:let b:sql_compl_type='resetCache'<CR><C-X><C-O> + imap <buffer> <c-c>R <C-\><C-O>:call sqlcomplete#Map('resetCache')<CR><C-X><C-O> + endif + + if b:sql_compl_savefunc != "" + " We are changing the filetype to SQL from some other filetype + " which had OMNI completion defined. We need to activate the + " SQL completion plugin in order to cache some of the syntax items + " while the syntax rules for SQL are active. + call sqlcomplete#PreCacheSyntax() endif endif |