runtime(gitcommit): Updates to ftplugin and syntax
Commit:
https://github.com/vim/vim/commit/fda02d03c0cfe017e465c58b3baf8b3106287578
Author: Tim Pope <[email protected]>
Date: Thu Dec 28 12:48:27 2023 -0500
runtime(gitcommit): Updates to ftplugin and syntax
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim
index 9342799b5..374932859 100644
--- a/runtime/ftplugin/gitcommit.vim
+++ b/runtime/ftplugin/gitcommit.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: git commit file
" Maintainer: Tim Pope <[email protected]>
-" Last Change: 2022 Jan 05
+" Last Change: 2023 Dec 28
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -12,7 +12,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]/','','')
@@ -42,6 +42,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
@@ -50,8 +55,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
diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim
index 42c8d4414..bce677276 100644
--- a/runtime/syntax/gitcommit.vim
+++ b/runtime/syntax/gitcommit.vim
@@ -2,7 +2,7 @@
" Language: git commit file
" Maintainer: Tim Pope <[email protected]>
" Filenames: *.git/COMMIT_EDITMSG
-" Last Change: 2022 Jan 05
+" Last Change: 2023 Dec 28
if exists("b:current_syntax")
finish
@@ -21,7 +21,11 @@ endif
syn include @gitcommitDiff syntax/diff.vim
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/
end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold
contains=@gitcommitDiff
-syn match gitcommitSummary "^.*\%<51v." contained
containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
+if get(g:, 'gitcommit_summary_length') < 0
+ syn match gitcommitSummary "^.*$" contained containedin=gitcommitFirstLine
nextgroup=gitcommitOverflow contains=@Spell
+elseif get(g:, 'gitcommit_summary_length', 1) > 0
+ exe 'syn match gitcommitSummary "^.*\%<' . (get(g:,
'gitcommit_summary_length', 50) + 1) . 'v." contained
containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell'
+endif
syn match gitcommitOverflow ".*" contained contains=@Spell
syn match gitcommitBlank "^.\+" contained contains=@Spell
syn match gitcommitFirstLine "\%^.*"
nextgroup=gitcommitBlank,gitcommitComment skipnl
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1rIytB-001GL0-SE%40256bit.org.