]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(jjdescription): allow to configure summary width
authorEmilia <emilia@bewitching.dev>
Sat, 11 Apr 2026 15:34:53 +0000 (15:34 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 11 Apr 2026 15:37:40 +0000 (15:37 +0000)
Allow to configure max length for the summary line and fall back to gits
setting.

closes: #19905

Signed-off-by: Emilia <emilia@bewitching.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/filetype.txt
runtime/doc/tags
runtime/syntax/jjdescription.vim

index 790cfc2bd189b000f83441bd43f482c970040f36..461f801ccc8a15df2f3241d2be6600e93ecf8c69 100644 (file)
@@ -1,4 +1,4 @@
-*filetype.txt* For Vim version 9.2.  Last change: 2026 Apr 09
+*filetype.txt* For Vim version 9.2.  Last change: 2026 Apr 11
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -806,6 +806,14 @@ To enable the recognition of Markdown comments each time after removing
 re-source "javaformat.vim" for Vim versions greater than `8.2.1397`: >
        runtime autoload/javaformat.vim
 <
+JUJUTSU DESCRIPTION                            *ft-jjdescription-plugin*
+
+The length of the first line of the commit message used for syntax
+highlighting can be configured via `g:jjcommit_summary_length`, and will
+fallback to `g:gitcommit_summary_length`.  The default is 50.  Example: >
+
+        let g:jjcommit_summary_length = 70
+<
 JSON-FORMAT                                            *ft-json-plugin*
 
 JSON filetype can be extended to use 'formatexpr' and "json.FormatExpr()"
@@ -816,7 +824,7 @@ Add following lines to $HOME/.vim/ftplugin/json.vim: >
        vim9script
        import autoload 'dist/json.vim'
        setl formatexpr=json.FormatExpr()
-
+<
 LUA                                    *ft-lua-plugin* *g:lua_folding*
 
 You can enable folding of Lua functions using |fold-expr| by: >
index 66f37316142976c1773f4b28b27e84636f51ca1a..1e0720b21afb8c0fb311667880d78a60539a69ad 100644 (file)
@@ -7601,6 +7601,7 @@ ft-inform-syntax  syntax.txt      /*ft-inform-syntax*
 ft-java-plugin filetype.txt    /*ft-java-plugin*
 ft-java-syntax syntax.txt      /*ft-java-syntax*
 ft-javascript-omni     insert.txt      /*ft-javascript-omni*
+ft-jjdescription-plugin        filetype.txt    /*ft-jjdescription-plugin*
 ft-jq-syntax   syntax.txt      /*ft-jq-syntax*
 ft-json-plugin filetype.txt    /*ft-json-plugin*
 ft-json-syntax syntax.txt      /*ft-json-syntax*
index f7b76ba2608f17a43ba4dd412e0af704a5eebde3..dcdcb39914ec68cf568ec486971e3285224d3e79 100644 (file)
@@ -5,6 +5,7 @@
 " 2025 Apr 17 by Vim Project (don't require space to start comments, #17130)
 " 2026 Apr 09 by Vim Project (anchor status regex to beginning of line, #19879)
 " 2026 Apr 09 by Vim Project (detect renames of files, #19879)
+" 2026 Apr 11 by Vim Project (configure summary length, #19905)
 
 if exists('b:current_syntax')
   finish
@@ -20,10 +21,21 @@ syn region jjComment start="^JJ:" end="$" contains=jjAdded,jjRemoved,jjChanged,j
 syn include @jjCommitDiff syntax/diff.vim
 syn region jjCommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@jjCommitDiff
 
-hi def link jjComment Comment
-hi def link jjAdded Added
-hi def link jjRemoved Removed
-hi def link jjChanged Changed
-hi def link jjRenamed Changed
+if get(g:, 'jjcommit_summary_length', get(g:, 'gitcommit_summary_length', 0)) < 0
+  syn match   jjdescriptionSummary     "^.*$" contained containedin=jjcommitFirstLine nextgroup=jjcommitOverflow contains=@Spell
+elseif get(g:, 'jjcommit_summary_length', get(g:, 'gitcommit_summary_length', 1)) > 0
+  exe 'syn match   jjdescriptionSummary        "^.*\%<' . (get(g:, 'jjcommit_summary_length', get(:g, 'gitcommit_summary_length', 50) + 1) . 'v." contained containedin=jjcommitFirstLine nextgroup=jjcommitOverflow contains=@Spell'
+endif
+syn match   jjcommitOverflow   ".*" contained contains=@Spell
+syn match   jjcommitBlank      "^.\+" contained contains=@Spell
+syn match   jjcommitFirstLine  "\%^.*" nextgroup=jjcommitBlank,jjComment skipnl
+
+hi def link jjcommitSummary    Keyword
+hi def link jjComment          Comment
+hi def link jjAdded            Added
+hi def link jjRemove           Removed
+hi def link jjChange           Changed
+hi def link jjRenamed          Changed
+hi def link jjcommitBlank      Error
 
 let b:current_syntax = 'jjdescription'