summaryrefslogtreecommitdiffstats
path: root/ftplugin/gitcommit.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2022-10-14 17:40:10 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2022-10-14 17:40:10 +0200
commitbc8a81d3592dab86334f27d1d43c080ebf680d42 (patch)
treef367857d8c196d36f2d6dec3c2f6c9d703b06b7c /ftplugin/gitcommit.vim
parent38282d58387cff48ac203f6912c05e4c8686141b (diff)
downloadvim-polyglot-bc8a81d3592dab86334f27d1d43c080ebf680d42.tar.gz
vim-polyglot-bc8a81d3592dab86334f27d1d43c080ebf680d42.zip
Update
Diffstat (limited to 'ftplugin/gitcommit.vim')
-rw-r--r--ftplugin/gitcommit.vim15
1 files changed, 9 insertions, 6 deletions
diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim
index 56e72973..bcd82356 100644
--- a/ftplugin/gitcommit.vim
+++ b/ftplugin/gitcommit.vim
@@ -5,7 +5,7 @@ endif
" Vim filetype plugin
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2019 Dec 05
+" Last Change: 2022 Jan 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -16,7 +16,7 @@ let b:did_ftplugin = 1
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
-setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
+setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+
setlocal include=^+++
setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
@@ -46,6 +46,11 @@ function! s:diffcomplete(A, L, P) abort
return args
endfunction
+function! s:setupdiff() abort
+ command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
+ setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
+endfunction
+
function! s:gitdiffcached(bang, ...) abort
let name = tempname()
if a:0
@@ -54,8 +59,6 @@ function! s:gitdiffcached(bang, ...) abort
let extra = "-p --stat=".&columns
endif
call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
- exe "pedit " . fnameescape(name)
- wincmd P
- command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
- setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
+ exe 'pedit +call\ s:setupdiff()' fnameescape(name)
+ silent! wincmd P
endfunction