annotate runtime/ftplugin/gitcommit.vim @ 34662:81e6583c8b73 v9.1.0214

patch 9.1.0214: Duplicate condition in win_lbr_chartabsize() Commit: https://github.com/vim/vim/commit/5532d3b3f0c73d4e0fa07122ebbed3bf201870f9 Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Mar 28 10:04:25 2024 +0100 patch 9.1.0214: Duplicate condition in win_lbr_chartabsize() Problem: Duplicate condition in win_lbr_chartabsize(). Solution: Remove the duplicate condition, as it's already checked above. (zeertzjq) closes: #14320 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Mar 2024 10:15:06 +0100
parents 9828ad8d79bd
children
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>
34039
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
4 " Last Change: 2023 Dec 28
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 let b:did_ftplugin = 1
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
12
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
13 setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
14 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
34039
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
15 setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
16 setlocal include=^+++
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
17 setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
18
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
19 let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat< inc< inex<'
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
20
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
21 let s:l = search('\C\m^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100)
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
22 let &l:comments = ':' . (matchstr(getline(s:l ? s:l : '$'), '^[#;@!$%^&|:]\S\@!') . '#')[0]
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
23 let &l:commentstring = &l:comments[1] . ' %s'
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
24 unlet s:l
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
25
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
26 if exists("g:no_gitcommit_commands")
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
27 finish
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
28 endif
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
29
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
30 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
31
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
32 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
33
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
34 function! s:diffcomplete(A, L, P) abort
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
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
39 if a:A !~ '^-' && !empty(getftype('.git'))
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
40 let args = args."\n".system("git diff --cached --name-only")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
42 return args
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
43 endfunction
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
44
34039
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
45 function! s:setupdiff() abort
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
46 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
47 setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
48 endfunction
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
49
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
50 function! s:gitdiffcached(bang, ...) abort
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
51 let name = tempname()
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
52 if a:0
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
53 let extra = join(map(copy(a:000), 'shellescape(v:val)'))
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
54 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
55 let extra = "-p --stat=".&columns
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
56 endif
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
57 call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
34039
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
58 exe 'pedit +call\ s:setupdiff()' fnameescape(name)
9828ad8d79bd runtime(gitcommit): Updates to ftplugin and syntax
Christian Brabandt <cb@256bit.org>
parents: 27036
diff changeset
59 silent! wincmd P
1619
b9740fb41986 updated for version 7.2a
vimboss
parents:
diff changeset
60 endfunction