aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/syntax/cabal.vim25
-rw-r--r--runtime/syntax/cabalconfig.vim30
-rw-r--r--runtime/syntax/cabalproject.vim28
3 files changed, 80 insertions, 3 deletions
diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim
index 73c7186a87..92e6b8331e 100644
--- a/runtime/syntax/cabal.vim
+++ b/runtime/syntax/cabal.vim
@@ -4,7 +4,7 @@
" Maintainer: Marcin Szamotulski <profunctor@pm.me>
" Previous Maintainer: Vincent Berthoux <twinside@gmail.com>
" File Types: .cabal
-" Last Change: 3 Oct 2020
+" Last Change: 21 Nov 2020
" v1.5: Incorporated changes from
" https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim
" Use `syn keyword` instead of `syn match`.
@@ -78,10 +78,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ default-extensions
\ author
\ autogen-modules
+ \ asm-sources
+ \ asm-options
\ branch
\ bug-reports
\ build-depends
\ build-tools
+ \ build-tools-depends
\ build-type
\ buildable
\ c-sources
@@ -89,33 +92,46 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ category
\ cc-options
\ copyright
+ \ cmm-sources
+ \ cmm-options
\ cpp-options
+ \ cxx-sources
\ data-dir
\ data-files
\ default
+ \ default-extensions
\ description
\ executable
\ exposed-modules
\ exposed
\ extensions
- \ extra-tmp-files
+ \ extra-bundled-libraries
\ extra-doc-files
+ \ extra-dynamic-library-flavours
+ \ extra-framework-dirs
+ \ extra-ghci-libraries
\ extra-lib-dirs
\ extra-libraries
+ \ extra-library-flavours
\ extra-source-files
- \ exta-tmp-files
+ \ extra-tmp-files
\ for example
\ frameworks
\ ghc-options
\ ghc-prof-options
\ ghc-shared-options
+ \ ghcjs-options
+ \ ghcjs-prof-options
+ \ ghcjs-shared-options
\ homepage
+ \ hs-source-dir
\ hs-source-dirs
\ hugs-options
\ import
\ include-dirs
\ includes
\ install-includes
+ \ js-sources
\ ld-options
\ license
\ license-file
@@ -123,10 +139,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion
\ main-is
\ maintainer
\ manual
+ \ mixins
\ module
\ name
\ nhc98-options
\ other-extensions
+ \ other-language
+ \ other-languages
\ other-modules
\ package-url
\ pkgconfig-depends
diff --git a/runtime/syntax/cabalconfig.vim b/runtime/syntax/cabalconfig.vim
new file mode 100644
index 0000000000..0165725c06
--- /dev/null
+++ b/runtime/syntax/cabalconfig.vim
@@ -0,0 +1,30 @@
+" Vim syntax file
+" Language: Cabal Config
+" Maintainer: profunctor@pm.me
+" Last Change: Marcin Szamotulski
+" Original Author: Marcin Szamotulski
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match CabalConfigSection /^\S[[:alpha:]]\+\%(-[[:alpha:]]\+\)*[^:]*$/
+syn region CabalConfigRegion matchgroup=CabalConfigKey start=/^\s*[[:alpha:]]\+\%(-[[:alpha:]]\+\)*:/ matchgroup=NONE end=/$/ contains=CabalConfigSeparator,CabalConfigKeyword,CabalConfigPath keepend
+syn match CabalConfigComment /^\s*--.*$/
+syn match CabalConfigValue /.*$/ contained
+syn match CabalConfigKey /[[:alpha:]]\+\%(-[[:alpha:]]\+\)*\ze:/
+syn keyword CabalConfigSeparator : contained
+syn match CabalConfigVariable /\$[[:alpha:]]\+/
+syn keyword CabalConfigKeyword True False ghc
+syn match CabalConfigPath /\%([[:alpha:]]\+:\)\?\%(\/[[:print:]]\+\)\+/
+
+hi def link CabalConfigComment Comment
+hi def link CabalConfigSection Title
+hi def link CabalConfigKey Statement
+hi def link CabalConfigSeparator NonText
+hi def link CabalConfigValue Normal
+hi def link CabalConfigVariable Identifier
+hi def link CabalConfigKeyword Keyword
+hi def link CabalConfigPath Directory
+
+let b:current_syntax = "cabal.config"
diff --git a/runtime/syntax/cabalproject.vim b/runtime/syntax/cabalproject.vim
new file mode 100644
index 0000000000..12143b9ee9
--- /dev/null
+++ b/runtime/syntax/cabalproject.vim
@@ -0,0 +1,28 @@
+" Vim syntax file
+" Language: Cabal Project
+" Maintainer: profunctor@pm.me
+" Last Change: Marcin Szamotulski
+" Original Author: Marcin Szamotulski
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match CabalProjectComment /^\s*--.*/ contains=@Spell
+syn match CabalProjectField /^\w\%(\w\|-\)\+/ contains=@NoSpell
+
+syn keyword CabalProjectBoolean true false True False
+syn keyword CabalProjectCompiler ghc ghcjs jhc lhc uhc haskell-suite
+syn match CabalProjectNat /\<\d\+\>/
+syn keyword CabalProjectJobs $ncpus
+syn keyword CabalProjectProfilingLevel default none exported-functions toplevel-functions all-functions
+
+hi def link CabalProjectComment Comment
+hi def link CabalProjectField Statement
+hi def link CabalProjectBoolean Boolean
+hi def link CabalProjectCompiler Identifier
+hi def link CabalProjectNat Number
+hi def link CabalProjectJobs Number
+hi def link CabalProjectProfilingLevel Statement
+
+let b:current_syntax = "cabal.project"