annotate runtime/ftplugin/gitcommit.vim @ 26215:b1d9ee2f2328 v8.2.3639

patch 8.2.3639: line commented out accidentally Commit: https://github.com/vim/vim/commit/7f0c4b418e01d6e056a74de2f22fcbad613b7591 Author: Volodymyr Kot <volodymyr.kot.ua@gmail.com> Date: Sun Nov 21 12:27:13 2021 +0000 patch 8.2.3639: line commented out accidentally Problem: Line commented out accidentally. Solution: Uncomment. (Volodymyr Kot, closes https://github.com/vim/vim/issues/9172)
author Bram Moolenaar <Bram@vim.org>
date Sun, 21 Nov 2021 13:30:03 +0100
parents 5c40013d45ee
children 3e661b0cf500
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>
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
4 " Last Change: 2019 Dec 05
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
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
14 setlocal comments=:# commentstring=#\ %s
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
15 setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
16 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
17 setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
18
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
19 let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<'
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
20
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
21 if exists("g:no_gitcommit_commands") || v:version < 700
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
22 finish
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
23 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
24
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
25 if !exists("b:git_dir")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
26 let b:git_dir = expand("%:p:h")
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
27 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
28
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
29 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
30
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
31 let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached"
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
32
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
33 function! s:diffcomplete(A,L,P)
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
34 let args = ""
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
35 if a:P <= match(a:L." -- "," -- ")+3
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
36 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
37 end
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
38 if exists("b:git_dir") && a:A !~ '^-'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
39 let tree = fnamemodify(b:git_dir,':h')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
40 if strpart(getcwd(),0,strlen(tree)) == tree
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41 let args = args."\n".system("git diff --cached --name-only")
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
42 endif
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
43 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
44 return args
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
45 endfunction
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
46
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
47 function! s:gitdiffcached(bang,gitdir,...)
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
48 let tree = fnamemodify(a:gitdir,':h')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
49 let name = tempname()
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
50 let git = "git"
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
51 if strpart(getcwd(),0,strlen(tree)) != tree
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
52 let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
53 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
54 if a:0
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
55 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
56 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
57 let extra = "-p --stat=".&columns
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
58 endif
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
59 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
60 exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
61 wincmd P
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
62 let b:git_dir = a:gitdir
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
63 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
64 nnoremap <buffer> <silent> q :q<CR>
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
65 setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
66 endfunction