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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
1 " Vim filetype plugin
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
2 " Language: git commit file
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
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
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
5
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
6 " Only do this when not done yet for this buffer
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
7 if (exists("b:did_ftplugin"))
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
8 finish
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
9 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
10
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
11 runtime! ftplugin/git.vim
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
12 let b:did_ftplugin = 1
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
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
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
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
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
17
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
18 if &textwidth == 0
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
19 " make sure that log messages play nice with git-log on standard terminals
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
20 setlocal textwidth=72
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
21 let b:undo_ftplugin .= "|setl tw<"
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
22 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
23
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
24 if exists("g:no_gitcommit_commands") || v:version < 700
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
25 finish
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
26 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
27
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
28 if !exists("b:git_dir")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
29 let b:git_dir = expand("%:p:h")
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
30 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
31
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
32 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
33
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
34 function! s:diffcomplete(A,L,P)
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
35 let args = ""
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
36 if a:P <= match(a:L." -- "," -- ")+3
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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"
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
38 end
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
39 if exists("b:git_dir") && a:A !~ '^-'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
40 let tree = fnamemodify(b:git_dir,':h')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41 if strpart(getcwd(),0,strlen(tree)) == tree
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
42 let args = args."\n".system("git diff --cached --name-only")
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
43 endif
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
44 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
45 return args
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
46 endfunction
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
47
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
48 function! s:gitdiffcached(bang,gitdir,...)
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
49 let tree = fnamemodify(a:gitdir,':h')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
50 let name = tempname()
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
51 let git = "git"
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
52 if strpart(getcwd(),0,strlen(tree)) != tree
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
53 let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
54 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
55 if a:0
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
56 let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
57 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
58 let extra = "-p --stat=".&columns
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
59 endif
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
60 call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
61 exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
62 wincmd P
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
63 let b:git_dir = a:gitdir
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
64 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
65 nnoremap <buffer> <silent> q :q<CR>
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
66 setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
67 endfunction