]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0371: filetype: ghostty config files are not recognized v9.2.0371
authorBez Hermoso <bezalelhermoso@gmail.com>
Mon, 20 Apr 2026 14:47:58 +0000 (14:47 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 20 Apr 2026 14:50:37 +0000 (14:50 +0000)
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: #20002

Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Bez Hermoso <me@bez.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/ft.vim
runtime/filetype.vim
runtime/ftplugin/ghostty.vim [new file with mode: 0644]
src/testdir/test_filetype.vim
src/version.c

index f0330c205cc12dc3581b5866fc325e5dfc9094ee..7b7fb2954da57355638cb3e3aa9667d5dcf5c8e4 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 Apr 15
+# Last Change:         2026 Apr 20
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -3113,7 +3113,9 @@ const ft_from_ext = {
   "bp": "bp",
   # Tiltfile
   "Tiltfile": "tiltfile",
-  "tiltfile": "tiltfile"
+  "tiltfile": "tiltfile",
+  # Ghostty
+  "ghostty": "ghostty",
 }
 # Key: file name (the final path component, excluding the drive and root)
 # Value: filetype
index 0c76a60a5235b12e9acd3c7450651e8a6160a746..da632acc54f224ae2c115a79032630000a1fde9a 100644 (file)
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:          The Vim Project <https://github.com/vim/vim>
-" Last Change:         2026 Apr 08
+" Last Change:         2026 Apr 20
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " If the filetype can be detected from extension or file name(the final path component),
@@ -1617,6 +1617,10 @@ au BufNewFile,BufRead *.txt
        \|   setf text
        \| endif
 
+" Ghostty configuration
+au BufNewFile,BufRead */ghostty/config                      setf ghostty
+au BufNewFile,BufRead */ghostty/themes/*                    call s:StarSetf('ghostty')
+au BufNewFile,BufRead */com.mitchellh.ghostty/config        setf ghostty
 
 
 " Generic log file
diff --git a/runtime/ftplugin/ghostty.vim b/runtime/ftplugin/ghostty.vim
new file mode 100644 (file)
index 0000000..479fd61
--- /dev/null
@@ -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
index 892cd323884a7c341d1973d1337659beda6542f0..583dad4d1c1915c97f602ed2d65f5f396f0a6e2a 100644 (file)
@@ -327,6 +327,9 @@ def s:GetFilenameChecks(): dict<list<string>>
     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'] + WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'),
     gitcommit: ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'],
index 489ec89deebab6d93cedb709920acb4e11f4921d..4cdbfdc0579075adc22833d7b82936b621fc480e 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    371,
 /**/
     370,
 /**/