From b365036ab3f5e91439a5397ed0f32b651d60f08c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 3 Jan 2025 10:42:52 +0100 Subject: vim-patch:9.1.0986: filetype: 'jj' filetype is a bit imprecise Problem: filetype: 'jj' filetype is a bit imprecise Solution: rename 'jj' filetype to 'jjdescription' (Gregory Anders) closes: vim/vim#16364 https://github.com/vim/vim/commit/58c44e8833365e1a777330491c2799ae324ed893 Co-authored-by: Gregory Anders --- runtime/ftplugin/jj.vim | 19 ------------------- runtime/ftplugin/jjdescription.vim | 19 +++++++++++++++++++ runtime/lua/vim/filetype.lua | 2 +- runtime/syntax/jj.vim | 24 ------------------------ runtime/syntax/jjdescription.vim | 24 ++++++++++++++++++++++++ test/old/testdir/test_filetype.vim | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 runtime/ftplugin/jj.vim create mode 100644 runtime/ftplugin/jjdescription.vim delete mode 100644 runtime/syntax/jj.vim create mode 100644 runtime/syntax/jjdescription.vim diff --git a/runtime/ftplugin/jj.vim b/runtime/ftplugin/jj.vim deleted file mode 100644 index cc5d700a30..0000000000 --- a/runtime/ftplugin/jj.vim +++ /dev/null @@ -1,19 +0,0 @@ -" Vim filetype plugin -" Language: jj description -" Maintainer: Gregory Anders -" Last Change: 2024 May 8 - -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -" Use the same formatoptions and textwidth as the gitcommit ftplugin -setlocal nomodeline formatoptions+=tl textwidth=72 -setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n -setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+ - -setlocal comments=b:JJ: -setlocal commentstring=JJ:\ %s - -let b:undo_ftplugin = 'setl modeline< formatoptions< textwidth< formatlistpat< comments< commentstring<' diff --git a/runtime/ftplugin/jjdescription.vim b/runtime/ftplugin/jjdescription.vim new file mode 100644 index 0000000000..cc5d700a30 --- /dev/null +++ b/runtime/ftplugin/jjdescription.vim @@ -0,0 +1,19 @@ +" Vim filetype plugin +" Language: jj description +" Maintainer: Gregory Anders +" Last Change: 2024 May 8 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +" Use the same formatoptions and textwidth as the gitcommit ftplugin +setlocal nomodeline formatoptions+=tl textwidth=72 +setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+ + +setlocal comments=b:JJ: +setlocal commentstring=JJ:\ %s + +let b:undo_ftplugin = 'setl modeline< formatoptions< textwidth< formatlistpat< comments< commentstring<' diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 173de8b5d5..849bc4af92 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -631,7 +631,7 @@ local extension = { clp = 'jess', jgr = 'jgraph', jinja = 'jinja', - jjdescription = 'jj', + jjdescription = 'jjdescription', j73 = 'jovial', jov = 'jovial', jovial = 'jovial', diff --git a/runtime/syntax/jj.vim b/runtime/syntax/jj.vim deleted file mode 100644 index 0b2d29e878..0000000000 --- a/runtime/syntax/jj.vim +++ /dev/null @@ -1,24 +0,0 @@ -" Vim syntax file -" Language: jj description -" Maintainer: Gregory Anders -" Last Change: 2024 May 8 - -if exists('b:current_syntax') - finish -endif - -syn match jjAdded "A .*" contained -syn match jjRemoved "D .*" contained -syn match jjChanged "M .*" contained - -syn region jjComment start="^JJ: " end="$" contains=jjAdded,jjRemoved,jjChanged - -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 - -let b:current_syntax = 'jj' diff --git a/runtime/syntax/jjdescription.vim b/runtime/syntax/jjdescription.vim new file mode 100644 index 0000000000..04848bcb3b --- /dev/null +++ b/runtime/syntax/jjdescription.vim @@ -0,0 +1,24 @@ +" Vim syntax file +" Language: jj description +" Maintainer: Gregory Anders +" Last Change: 2024 May 8 + +if exists('b:current_syntax') + finish +endif + +syn match jjAdded "A .*" contained +syn match jjRemoved "D .*" contained +syn match jjChanged "M .*" contained + +syn region jjComment start="^JJ: " end="$" contains=jjAdded,jjRemoved,jjChanged + +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 + +let b:current_syntax = 'jjdescription' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 1bf2bdb360..d5853adf49 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -389,7 +389,7 @@ func s:GetFilenameChecks() abort \ 'jess': ['file.clp'], \ 'jgraph': ['file.jgr'], \ 'jinja': ['file.jinja'], - \ 'jj': ['file.jjdescription'], + \ 'jjdescription': ['file.jjdescription'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], \ 'jq': ['file.jq'], -- cgit