Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cabalconfig filetype, closes #30

  • Loading branch information...
commit 30261c8bd4e377a1c0346dff239e6d4a76730819 1 parent b74e1b4
@dag authored
View
64 autoload/vim2hs/cabalconfig.vim
@@ -0,0 +1,64 @@
+function! vim2hs#cabalconfig#comments() " {{{
+ set commentstring=--%s
+
+ syntax match ccComment
+ \ /--.*/
+ \ display
+
+ highlight! link ccComment Comment
+endfunction " }}}
+
+
+function! vim2hs#cabalconfig#constants() " {{{
+ setlocal iskeyword=a-z,A-Z,-
+
+ syntax case match
+
+ syntax match ccKeyword
+ \ "^\s*\k\+\s*:\@="
+ \ display nextgroup=ccDelimiter
+
+ syntax match ccDelimiter
+ \ ":"
+ \ display contained
+
+ syntax keyword ccBoolean
+ \ True False
+
+ syntax match ccNumber
+ \ '\<[0-9]\+\>'
+ \ display
+
+ syntax match ccFloat
+ \ '\<[0-9]\+\.[0-9]\+'
+ \ display
+
+ highlight! link ccKeyword Keyword
+ highlight! link ccDelimiter Delimiter
+ highlight! link ccBoolean Boolean
+ highlight! link ccNumber Number
+ highlight! link ccFloat Float
+endfunction " }}}
+
+
+function! vim2hs#cabalconfig#statements() " {{{
+ syntax region ccIdentifier matchgroup=ccStatement
+ \ start='\c^\%(install-dirs\)\>'
+ \ end='$'
+ \ display oneline
+
+ highlight! link ccIdentifier Identifier
+ highlight! link ccStatement Statement
+endfunction " }}}
+
+
+function! vim2hs#cabalconfig#folds() " {{{
+ syntax region ccFold
+ \ start='\c^\%(install-dirs\)\>'
+ \ skip='\n#\|\n--'
+ \ end='\ze\%(\s*\n\)\+\S'
+ \ transparent fold
+
+ setlocal foldmethod=syntax
+ setlocal foldtext=getline(v:foldstart)
+endfunction " }}}
View
1  ftdetect/cabalconfig.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead ~/.cabal/config setlocal filetype=cabalconfig
View
8 syntax/cabalconfig.vim
@@ -0,0 +1,8 @@
+syntax clear
+
+call vim2hs#cabalconfig#comments()
+call vim2hs#cabalconfig#constants()
+call vim2hs#cabalconfig#statements()
+call vim2hs#cabalconfig#folds()
+
+let b:current_syntax = "cabalconfig"
Please sign in to comment.
Something went wrong with that request. Please try again.