diff options
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/cdrdaoconf.vim | 18 | ||||
-rw-r--r-- | runtime/ftplugin/debcontrol.vim | 70 | ||||
-rw-r--r-- | runtime/ftplugin/dosini.vim | 13 | ||||
-rw-r--r-- | runtime/ftplugin/gitconfig.vim | 15 | ||||
-rw-r--r-- | runtime/ftplugin/gitrebase.vim | 41 |
5 files changed, 157 insertions, 0 deletions
diff --git a/runtime/ftplugin/cdrdaoconf.vim b/runtime/ftplugin/cdrdaoconf.vim new file mode 100644 index 0000000000..86796eb8ec --- /dev/null +++ b/runtime/ftplugin/cdrdaoconf.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin file +" Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-09-18 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl com< cms< fo<" + +setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql + +let s:cpo_save = &cpo +set cpo&vim diff --git a/runtime/ftplugin/debcontrol.vim b/runtime/ftplugin/debcontrol.vim new file mode 100644 index 0000000000..2fb2ee7d34 --- /dev/null +++ b/runtime/ftplugin/debcontrol.vim @@ -0,0 +1,70 @@ +" Vim filetype plugin file (GUI menu and folding) +" Language: Debian control files +" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> +" Former Maintainer: Pierre Habouzit <madcoder@debian.org> +" Last Change: 2008-03-08 +" URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/ftplugin/debcontrol.vim;hb=debian + +" Do these settings once per buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +" {{{1 Local settings (do on every load) +if exists("g:debcontrol_fold_enable") + setlocal foldmethod=expr + setlocal foldexpr=DebControlFold(v:lnum) + setlocal foldtext=DebControlFoldText() +endif +setlocal textwidth=0 + +" Clean unloading +let b:undo_ftplugin = "setlocal tw< foldmethod< foldexpr< foldtext<" + +" }}}1 + +" {{{1 folding + +function! s:getField(f, lnum) + let line = getline(a:lnum) + let fwdsteps = 0 + while line !~ '^'.a:f.':' + let fwdsteps += 1 + let line = getline(a:lnum + fwdsteps) + if line == '' + return 'unknown' + endif + endwhile + return substitute(line, '^'.a:f.': *', '', '') +endfunction + +function! DebControlFoldText() + if v:folddashes == '-' " debcontrol entry fold + let type = substitute(getline(v:foldstart), ':.*', '', '') + if type == 'Source' + let ftext = substitute(foldtext(), ' *Source: *', ' ', '') + return ftext . ' -- ' . s:getField('Maintainer', v:foldstart) . ' ' + endif + let arch = s:getField('Architecture', v:foldstart) + let ftext = substitute(foldtext(), ' *Package: *', ' [' . arch . '] ', '') + return ftext . ': ' . s:getField('Description', v:foldstart) . ' ' + endif + return foldtext() +endfunction + +function! DebControlFold(l) + + " This is for not merging blank lines around folds to them + if getline(a:l) =~ '^Source:' + return '>1' + endif + + if getline(a:l) =~ '^Package:' + return '>1' + endif + + return '=' +endfunction + +" }}}1 diff --git a/runtime/ftplugin/dosini.vim b/runtime/ftplugin/dosini.vim new file mode 100644 index 0000000000..354b093ee5 --- /dev/null +++ b/runtime/ftplugin/dosini.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: Configuration File (ini file) for MSDOS/MS Windows +" Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-08-23 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl com< cms< fo<" + +setlocal comments=:; commentstring=;\ %s formatoptions-=t formatoptions+=croql diff --git a/runtime/ftplugin/gitconfig.vim b/runtime/ftplugin/gitconfig.vim new file mode 100644 index 0000000000..ee33baff23 --- /dev/null +++ b/runtime/ftplugin/gitconfig.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin +" Language: git config file +" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Last Change: 2007 Dec 16 + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif +let b:did_ftplugin = 1 + +setlocal formatoptions-=t formatoptions+=croql +setlocal comments=:#,:; commentstring=;\ %s + +let b:undo_ftplugin = "setl fo< com< cms<" diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim new file mode 100644 index 0000000000..6e0e6c19c5 --- /dev/null +++ b/runtime/ftplugin/gitrebase.vim @@ -0,0 +1,41 @@ +" Vim filetype plugin +" Language: git rebase --interactive +" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Last Change: 2008 Apr 16 + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif + +runtime! ftplugin/git.vim +let b:did_ftplugin = 1 + +setlocal comments=:# commentstring=#\ %s formatoptions-=t +if !exists("b:undo_ftplugin") + let b:undo_ftplugin = "" +endif +let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<" + +function! s:choose(word) + s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e +endfunction + +function! s:cycle() + call s:choose(get({'s':'edit','p':'squash'},getline('.')[0],'pick')) +endfunction + +command! -buffer -bar Pick :call s:choose('pick') +command! -buffer -bar Squash :call s:choose('squash') +command! -buffer -bar Edit :call s:choose('edit') +command! -buffer -bar Cycle :call s:cycle() +" The above are more useful when they are mapped; for example: +"nnoremap <buffer> <silent> S :Cycle<CR> + +if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") + finish +endif + +nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' + +let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K" |