diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-05-21 12:05:36 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-05-21 12:05:36 +0200 |
commit | 7a329911b9ae2b97453fd995bc3a6523cf3aab53 (patch) | |
tree | b75f6a117f48fe0c441b67cca09490f623233a74 /runtime/ftplugin | |
parent | c6af8125c7593b3ca104bf1feac0d814fe76d92d (diff) | |
download | vim-git-7a329911b9ae2b97453fd995bc3a6523cf3aab53.tar.gz |
Updated runtime files.
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/cucumber.vim | 1 | ||||
-rw-r--r-- | runtime/ftplugin/git.vim | 32 | ||||
-rw-r--r-- | runtime/ftplugin/gitcommit.vim | 62 | ||||
-rw-r--r-- | runtime/ftplugin/gitrebase.vim | 13 | ||||
-rw-r--r-- | runtime/ftplugin/haml.vim | 5 | ||||
-rw-r--r-- | runtime/ftplugin/liquid.vim | 61 | ||||
-rw-r--r-- | runtime/ftplugin/markdown.vim | 19 | ||||
-rw-r--r-- | runtime/ftplugin/sass.vim | 3 |
8 files changed, 140 insertions, 56 deletions
diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim index 8ef8c2399..63cfbcf33 100644 --- a/runtime/ftplugin/cucumber.vim +++ b/runtime/ftplugin/cucumber.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim index 63d4f338e..e043c7587 100644 --- a/runtime/ftplugin/git.vim +++ b/runtime/ftplugin/git.vim @@ -1,33 +1,33 @@ " Vim filetype plugin " Language: generic git output " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif let b:did_ftplugin = 1 if !exists('b:git_dir') - if expand('%:p') =~# '\.git\>' - let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') - elseif $GIT_DIR != '' - let b:git_dir = $GIT_DIR - endif - if (has('win32') || has('win64')) && exists('b:git_dir') - let b:git_dir = substitute(b:git_dir,'\\','/','g') - endif + if expand('%:p') =~# '\.git\>' + let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') + elseif $GIT_DIR != '' + let b:git_dir = $GIT_DIR + endif + if (has('win32') || has('win64')) && exists('b:git_dir') + let b:git_dir = substitute(b:git_dir,'\\','/','g') + endif endif if exists('*shellescape') && exists('b:git_dir') && b:git_dir != '' - if b:git_dir =~# '/\.git$' " Not a bare repository - let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path - endif - let &l:path = escape(b:git_dir,'\, ').','.&l:path - let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' + if b:git_dir =~# '/\.git$' " Not a bare repository + let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path + endif + let &l:path = escape(b:git_dir,'\, ').','.&l:path + let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' else - setlocal keywordprg=git\ show + setlocal keywordprg=git\ show endif if has('gui_running') let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index f8788c844..94d635c5d 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -15,7 +15,7 @@ if &textwidth == 0 " make sure that log messages play nice with git-log on standard terminals setlocal textwidth=72 if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" + let b:undo_ftplugin = "" endif let b:undo_ftplugin = b:undo_ftplugin . "|setl tw<" endif @@ -25,7 +25,7 @@ if exists("g:no_gitcommit_commands") || v:version < 700 endif if !exists("b:git_dir") - let b:git_dir = expand("%:p:h") + let b:git_dir = expand("%:p:h") endif " Automatically diffing can be done with: @@ -33,36 +33,36 @@ endif command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) function! s:diffcomplete(A,L,P) - let args = "" - if a:P <= match(a:L." -- "," -- ")+3 - let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" - end - if exists("b:git_dir") && a:A !~ '^-' - let tree = fnamemodify(b:git_dir,':h') - if strpart(getcwd(),0,strlen(tree)) == tree - let args = args."\n".system("git diff --cached --name-only") - endif + let args = "" + if a:P <= match(a:L." -- "," -- ")+3 + let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" + end + if exists("b:git_dir") && a:A !~ '^-' + let tree = fnamemodify(b:git_dir,':h') + if strpart(getcwd(),0,strlen(tree)) == tree + let args = args."\n".system("git diff --cached --name-only") endif - return args + endif + return args endfunction function! s:gitdiffcached(bang,gitdir,...) - let tree = fnamemodify(a:gitdir,':h') - let name = tempname() - let git = "git" - if strpart(getcwd(),0,strlen(tree)) != tree - let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') - endif - if a:0 - let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) - else - let extra = "-p --stat=".&columns - endif - call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) - exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) - wincmd P - let b:git_dir = a:gitdir - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) - nnoremap <silent> q :q<CR> - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git + let tree = fnamemodify(a:gitdir,':h') + let name = tempname() + let git = "git" + if strpart(getcwd(),0,strlen(tree)) != tree + let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') + endif + if a:0 + let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) + else + let extra = "-p --stat=".&columns + endif + call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) + exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) + wincmd P + let b:git_dir = a:gitdir + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) + nnoremap <silent> q :q<CR> + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git endfunction diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim index 4680d285e..0200ba1ac 100644 --- a/runtime/ftplugin/gitrebase.vim +++ b/runtime/ftplugin/gitrebase.vim @@ -1,11 +1,11 @@ " Vim filetype plugin " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif runtime! ftplugin/git.vim @@ -13,28 +13,29 @@ let b:did_ftplugin = 1 setlocal comments=:# commentstring=#\ %s formatoptions-=t if !exists("b:undo_ftplugin") - let 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 + 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','e':'reword'},getline('.')[0],'pick')) + call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},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 Reword :call s:choose('reword') +command! -buffer -bar Fixup :call s:choose('fixup') 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 + finish endif nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim index 0a39d5ef3..b2c1eca3f 100644 --- a/runtime/ftplugin/haml.vim +++ b/runtime/ftplugin/haml.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Haml -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -56,7 +57,7 @@ if exists("loaded_matchit") let b:match_words = s:match_words endif -setlocal commentstring=-#\ %s +setlocal comments= commentstring=-#\ %s let b:undo_ftplugin = "setl cms< com< " \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin diff --git a/runtime/ftplugin/liquid.vim b/runtime/ftplugin/liquid.vim new file mode 100644 index 000000000..b211a884c --- /dev/null +++ b/runtime/ftplugin/liquid.vim @@ -0,0 +1,61 @@ +" Vim filetype plugin +" Language: Liquid +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 + +if exists('b:did_ftplugin') + finish +endif + +if !exists('g:liquid_default_subtype') + let g:liquid_default_subtype = 'html' +endif + +if !exists('b:liquid_subtype') + let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+') + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = g:liquid_default_subtype + endif +endif + +if exists('b:liquid_subtype') && b:liquid_subtype != '' + exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim' +else + runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +endif +let b:did_ftplugin = 1 + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= '|' +else + let b:undo_ftplugin = '' +endif +if exists('b:browsefilter') + let b:browsefilter = "\n".b:browsefilter +else + let b:browsefilter = '' +endif +if exists('b:match_words') + let b:match_words .= ',' +elseif exists('loaded_matchit') + let b:match_words = '' +endif + +if has('gui_win32') + let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter +endif + +if exists('loaded_matchit') + let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,<\(capture\|comment\|highlight\)\>:\<end\1\>' +endif + +setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %} + +let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words' diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim new file mode 100644 index 000000000..946208203 --- /dev/null +++ b/runtime/ftplugin/markdown.vim @@ -0,0 +1,19 @@ +" Vim filetype plugin +" Language: Markdown +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 + +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ + +let b:undo_ftplugin .= "|setl cms< com< fo<" + +" vim:set sw=2: diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim index ad039772a..9a9993173 100644 --- a/runtime/ftplugin/sass.vim +++ b/runtime/ftplugin/sass.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Sass -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") |