Mercurial > vim
annotate runtime/ftplugin/gitcommit.vim @ 32756:ce3269eea32c v9.0.1697
patch 9.0.1697: incsearch test not sufficient
Commit: https://github.com/vim/vim/commit/73b8209266f0cd5c6d4df77b3700172d9c26df31
Author: Christ van Willegen <cvwillegen@gmail.com>
Date: Sat Aug 12 20:17:26 2023 +0200
patch 9.0.1697: incsearch test not sufficient
Problem: incsearch test not sufficient (after 9.0.1691)
Solution: add an additional test
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 12 Aug 2023 20:30:04 +0200 |
parents | 3e661b0cf500 |
children | 9828ad8d79bd |
rev | line source |
---|---|
1619 | 1 " Vim filetype plugin |
2034 | 2 " Language: git commit file |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
27036 | 4 " Last Change: 2022 Jan 05 |
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 let b:did_ftplugin = 1 | |
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 | 14 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n |
15 setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+ | |
27036 | 16 setlocal include=^+++ |
17 setlocal includeexpr=substitute(v:fname,'^[bi]/','','') | |
18818 | 18 |
27036 | 19 let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat< inc< inex<' |
1619 | 20 |
27036 | 21 let s:l = search('\C\m^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100) |
22 let &l:comments = ':' . (matchstr(getline(s:l ? s:l : '$'), '^[#;@!$%^&|:]\S\@!') . '#')[0] | |
23 let &l:commentstring = &l:comments[1] . ' %s' | |
24 unlet s:l | |
25 | |
26 if exists("g:no_gitcommit_commands") | |
1619 | 27 finish |
28 endif | |
29 | |
27036 | 30 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>) |
1619 | 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 | 34 function! s:diffcomplete(A, L, P) abort |
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 | |
27036 | 39 if a:A !~ '^-' && !empty(getftype('.git')) |
40 let args = args."\n".system("git diff --cached --name-only") | |
2202 | 41 endif |
42 return args | |
1619 | 43 endfunction |
44 | |
27036 | 45 function! s:gitdiffcached(bang, ...) abort |
2202 | 46 let name = tempname() |
47 if a:0 | |
27036 | 48 let extra = join(map(copy(a:000), 'shellescape(v:val)')) |
2202 | 49 else |
50 let extra = "-p --stat=".&columns | |
51 endif | |
27036 | 52 call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name)) |
53 exe "pedit " . fnameescape(name) | |
2202 | 54 wincmd P |
27036 | 55 command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>) |
2202 | 56 setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git |
1619 | 57 endfunction |