# HG changeset patch # User Christian Brabandt # Date 1699690504 -3600 # Node ID 4006051bf85de43dc03759d6e54dca61e9e7e485 # Parent 35aaf01f7d6186eaa781f4617711be2f0b991200 patch 9.0.2098: No filetype support for xcompose files Commit: https://github.com/vim/vim/commit/4f9074b96cc7efb1c829ca74902a851551dcf4e8 Author: ObserverOfTime Date: Sat Nov 11 09:12:27 2023 +0100 patch 9.0.2098: No filetype support for xcompose files Problem: No filetype support for xcompose files Solution: Add filetype detection closes: #13508 Signed-off-by: ObserverOfTime Signed-off-by: Christian Brabandt diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -237,6 +237,7 @@ runtime/ftplugin/vdf.vim @ObserverOfTim runtime/ftplugin/wast.vim @rhysd runtime/ftplugin/wget.vim @dkearns runtime/ftplugin/wget2.vim @dkearns +runtime/ftplugin/xcompose.vim @ObserverOfTime runtime/ftplugin/xml.vim @chrisbra runtime/ftplugin/xs.vim @petdance runtime/ftplugin/zsh.vim @chrisbra @@ -525,6 +526,7 @@ runtime/syntax/wdl.vim @zenmatic runtime/syntax/wget.vim @dkearns runtime/syntax/wget2.vim @dkearns runtime/syntax/xbl.vim @dkearns +runtime/syntax/xcompose.vim @ObserverOfTime runtime/syntax/xmath.vim @cecamp runtime/syntax/xml.vim @chrisbra runtime/syntax/xs.vim @petdance diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2537,6 +2537,9 @@ au BufNewFile,BufRead */etc/xinetd.conf " XS Perl extension interface language au BufNewFile,BufRead *.xs setf xs +" X compose file +au BufNewFile,BufRead .XCompose,Compose setf xcompose + " X resources file au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults diff --git a/runtime/ftplugin/xcompose.vim b/runtime/ftplugin/xcompose.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/xcompose.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: XCompose +" Maintainer: ObserverOfTime +" Filenames: .XCompose, Compose +" Last Change: 2023 Nov 09 + +" Comments +syn keyword xcomposeTodo contained TODO FIXME XXX +syn match xcomposeComment /#.*/ contains=xcomposeTodo + +" Includes +syn keyword xcomposeInclude include nextgroup=xcomposeFile skipwhite +syn match xcomposeFile /"\([^"]\|\\"\)\+"/ contained +syn match xcomposeSubstitution /%[HLS]/ contained containedin=xcomposeFile + +" Modifiers +syn keyword xcomposeModifier Ctrl Lock Caps Shift Alt Meta None +syn match xcomposeModifierPrefix /\s*\zs[!~]\ze\s*/ + +" Keysyms +syn match xcomposeKeysym /<[A-Za-z0-9_]\+>/ +syn match xcomposeKeysym /[A-Za-z0-9_]\+/ contained +syn match xcomposeString /"\([^"]\|\\"\)\+"/ contained nextgroup=xcomposeKeysym skipwhite +syn match xcomposeColon /:/ nextgroup=xcomposeKeysym,xcomposeString skipwhite + +hi def link xcomposeColon Delimiter +hi def link xcomposeComment Comment +hi def link xcomposeFile String +hi def link xcomposeInclude Include +hi def link xcomposeKeysym Constant +hi def link xcomposeModifier Function +hi def link xcomposeModifierPrefix Operator +hi def link xcomposeString String +hi def link xcomposeSubstitution Special +hi def link xcomposeTodo Todo + +let b:current_syntax = 'xcompose' diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -799,6 +799,7 @@ def s:GetFilenameChecks(): dict