aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-19 23:19:08 -0500
committerGitHub <noreply@github.com>2020-11-19 23:19:08 -0500
commitda4e7ed4e9a24e451294c1fe396936d8a8d1f739 (patch)
treeb72f399d28d1260dd6645b749f29d679e0b74588
parentad56527247353df4a83fc7232d8680083ec4f24f (diff)
parent9e405c44b94872923be29c5e736d12d266155a4b (diff)
downloadrneovim-da4e7ed4e9a24e451294c1fe396936d8a8d1f739.tar.gz
rneovim-da4e7ed4e9a24e451294c1fe396936d8a8d1f739.tar.bz2
rneovim-da4e7ed4e9a24e451294c1fe396936d8a8d1f739.zip
Merge pull request #13330 from adrian5/filetype-gitcommit
runtime: Patch gitcommit.vim syntax
-rw-r--r--runtime/ftplugin/gitcommit.vim8
-rw-r--r--runtime/syntax/gitcommit.vim15
2 files changed, 16 insertions, 7 deletions
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim
index 6767ff719e..9b1998acaa 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 <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -13,8 +13,10 @@ let b:did_ftplugin = 1
setlocal comments=:# commentstring=#\ %s
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
-setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q
-let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<'
+setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
+setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
+
+let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<'
if exists("g:no_gitcommit_commands") || v:version < 700
finish
diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim
index 5e0642fbcc..63b1ce920f 100644
--- a/runtime/syntax/gitcommit.vim
+++ b/runtime/syntax/gitcommit.vim
@@ -2,7 +2,7 @@
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.git/COMMIT_EDITMSG
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
if exists("b:current_syntax")
finish
@@ -18,11 +18,18 @@ endif
syn include @gitcommitDiff syntax/diff.vim
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
-syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
-syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
+syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
syn match gitcommitOverflow ".*" contained contains=@Spell
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
-syn match gitcommitComment "^#.*"
+
+if get(g:, "gitcommit_cleanup") is# "scissors"
+ syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank skipnl
+ syn region gitcommitComment start=/^# -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff
+else
+ syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
+ syn match gitcommitComment "^#.*"
+endif
+
syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite