]> granicus.if.org Git - vim/commitdiff
patch 8.2.2032: cabalconfig and cabalproject filetypes not recognized v8.2.2032
authorBram Moolenaar <Bram@vim.org>
Sun, 22 Nov 2020 14:51:24 +0000 (15:51 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 22 Nov 2020 14:51:24 +0000 (15:51 +0100)
Problem:    Cabalconfig and cabalproject filetypes not recognized.
Solution:   Detect more cabal files. (Marcin Szamotulski, closes #7339)

runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 938140203175aadc19be4d870ef6f9d560b17891..35b73f9292b9975e7ff621a2ddc4a3109f4899f0 100644 (file)
@@ -696,12 +696,21 @@ au BufNewFile,BufRead .gtkrc,gtkrc                setf gtkrc
 au BufNewFile,BufRead *.haml                   setf haml
 
 " Hamster Classic | Playground files
-au BufNewFile,BufRead *.hsc,*.hsm              setf hamster
+au BufNewFile,BufRead *.hsm                    setf hamster
+au BufNewFile,BufRead *.hsc
+       \ if match(join(getline(1,10), "\n"), '\%(^\|\n\)\s*\%({-#\_s*LANGUAGE\>\|\<module\>\)') != -1 |
+       \   setf haskell |
+       \ else |
+       \   setf hamster |
+       \ endif
 
 " Haskell
 au BufNewFile,BufRead *.hs,*.hs-boot           setf haskell
 au BufNewFile,BufRead *.lhs                    setf lhaskell
 au BufNewFile,BufRead *.chs                    setf chaskell
+au BufNewFile,BufRead cabal.project            setf cabalproject
+au BufNewFile,BufRead $HOME/.cabal/config      setf cabalconfig
+au BufNewFile,BufRead cabal.config             setf cabalconfig
 
 " Haste
 au BufNewFile,BufRead *.ht                     setf haste
@@ -2037,12 +2046,14 @@ au BufNewFile,BufRead bzr_log.*                 setf bzr
 
 " Bazel build file
 if !has("fname_case")
-  au BufNewFile,BufRead *.BUILD,BUILD                  setf bzl
+  au BufNewFile,BufRead *.BUILD,BUILD          setf bzl
 endif
 
 " BIND zone
 au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone')
 
+au BufNewFile,BufRead cabal.project.*          call s:StarSetf('cabalproject')
+
 " Calendar
 au BufNewFile,BufRead */.calendar/*,
        \*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
index 90e2ca080f00ea2509760eb0afb1b77bb938dd6f..f3f622eb449462b34f73fb163e50bf6bf2c64e27 100644 (file)
@@ -87,6 +87,8 @@ let s:filename_checks = {
     \ 'bzr': ['bzr_log.any', 'bzr_log.file'],
     \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'],
     \ 'cabal': ['file.cabal'],
+    \ 'cabalconfig': ['cabal.config'],
+    \ 'cabalproject': ['cabal.project', 'cabal.project.local'],
     \ 'calendar': ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'],
     \ 'catalog': ['catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'],
     \ 'cdl': ['file.cdl'],
index 14eb31380c7404b6319edad46bcae77c0bc3d8e0..97c1e11cecc1810a44ec1d398fe75d98d751c01c 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2032,
 /**/
     2031,
 /**/