vim-patch:9.2.0371: filetype: ghostty config files are not recognized (#39267)

Problem:  filetype: ghostty config files are not recognized
Solution: Detect ghostty configuration files as ghostty filetype,
          include a simple ghostty filetype plugin (Bez Hermoso)

closes: vim/vim#20002

b30803b231

Co-authored-by: Bez Hermoso <bezalelhermoso@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-04-21 10:24:07 +08:00
committed by GitHub
parent 7d3e275b07
commit 32e249dfa6
3 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
" Vim filetype plugin file
" Language: ghostty
" Quit if a ftplugin file was already loaded
if exists("b:did_ftplugin")
finish
endif
" Use the cfg plugin, it's similar enough.
runtime! ftplugin/cfg.vim

View File

@@ -565,6 +565,7 @@ local extension = {
gel = 'gel',
gmi = 'gemtext',
gemini = 'gemtext',
ghostty = 'ghostty',
gift = 'gift',
prettierignore = 'gitignore',
gleam = 'gleam',
@@ -2487,6 +2488,8 @@ local pattern = {
['/mypy/config$'] = 'dosini',
['^${HOME}/%.config/notmuch/.*/config$'] = 'dosini',
['^${XDG_CONFIG_HOME}/notmuch/.*/config$'] = 'dosini',
['/ghostty/config$'] = 'ghostty',
['/com%.mitchellh%.ghostty/config$'] = 'ghostty',
['^${XDG_CONFIG_HOME}/git/config$'] = 'gitconfig',
['%.git/config%.worktree$'] = 'gitconfig',
['%.git/config$'] = 'gitconfig',
@@ -2743,6 +2746,7 @@ local pattern = {
['^[a-zA-Z].*Properties%.'] = starsetf(detect.foam),
['^[a-zA-Z].*Properties$'] = detect.foam,
['/tmp/lltmp'] = starsetf('gedcom'),
['/ghostty/themes/'] = starsetf('ghostty'),
['^gkrellmrc_.$'] = 'gkrellmrc',
['^${GNUPGHOME}/options$'] = 'gpg',
['/boot/grub/menu%.lst$'] = 'grub',

View File

@@ -327,6 +327,9 @@ func s:GetFilenameChecks() abort
\ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'],
\ 'gel': ['file.gel'],
\ 'gemtext': ['file.gmi', 'file.gemini'],
\ 'ghostty': ['ghostty/config', 'ghostty/keymaps.ghostty', '/.config/ghostty/config', '/.config/ghostty/keymaps.ghostty',
\ '~/Library/Application Support/com.mitchellh.ghostty/config.ghostty', '~/Library/Application Support/com.mitchellh.ghostty/config',
\ '~/.config/ghostty/themes/Custom Theme', '/usr/share/ghostty/themes/Builtin Theme'],
\ 'gift': ['file.gift'],
\ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'),
\ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'],