Mercurial > vim
annotate runtime/ftplugin/gitcommit.vim @ 4762:47906f888725 v7.3.1128
updated for version 7.3.1128
Problem: Now that the NFA engine handles everything every failure is a
syntax error.
Solution: Remove the syntax_error flag.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 05 Jun 2013 21:42:53 +0200 |
parents | 2eb30f341e8d |
children | 43efa4f5a8ea |
rev | line source |
---|---|
1619 | 1 " Vim filetype plugin |
2034 | 2 " Language: git commit file |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
4 " Last Change: 2013 May 30 |
1619 | 5 |
6 " Only do this when not done yet for this buffer | |
7 if (exists("b:did_ftplugin")) | |
8 finish | |
9 endif | |
10 | |
11 runtime! ftplugin/git.vim | |
12 let b:did_ftplugin = 1 | |
13 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
14 setlocal nomodeline tabstop=8 formatoptions-=croq formatoptions+=tl |
3465 | 15 |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
16 let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions<' |
3465 | 17 |
1619 | 18 if &textwidth == 0 |
19 " make sure that log messages play nice with git-log on standard terminals | |
20 setlocal textwidth=72 | |
3465 | 21 let b:undo_ftplugin .= "|setl tw<" |
1619 | 22 endif |
23 | |
24 if exists("g:no_gitcommit_commands") || v:version < 700 | |
25 finish | |
26 endif | |
27 | |
28 if !exists("b:git_dir") | |
2202 | 29 let b:git_dir = expand("%:p:h") |
1619 | 30 endif |
31 | |
32 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) | |
33 | |
34 function! s:diffcomplete(A,L,P) | |
2202 | 35 let args = "" |
36 if a:P <= match(a:L." -- "," -- ")+3 | |
37 let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" | |
38 end | |
39 if exists("b:git_dir") && a:A !~ '^-' | |
40 let tree = fnamemodify(b:git_dir,':h') | |
41 if strpart(getcwd(),0,strlen(tree)) == tree | |
42 let args = args."\n".system("git diff --cached --name-only") | |
1619 | 43 endif |
2202 | 44 endif |
45 return args | |
1619 | 46 endfunction |
47 | |
48 function! s:gitdiffcached(bang,gitdir,...) | |
2202 | 49 let tree = fnamemodify(a:gitdir,':h') |
50 let name = tempname() | |
51 let git = "git" | |
52 if strpart(getcwd(),0,strlen(tree)) != tree | |
53 let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') | |
54 endif | |
55 if a:0 | |
56 let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) | |
57 else | |
58 let extra = "-p --stat=".&columns | |
59 endif | |
3465 | 60 call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) |
2202 | 61 exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) |
62 wincmd P | |
63 let b:git_dir = a:gitdir | |
64 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) | |
3465 | 65 nnoremap <buffer> <silent> q :q<CR> |
2202 | 66 setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git |
1619 | 67 endfunction |