Permalink
Browse files

Different postprocess for different filetype

  • Loading branch information...
othree_kao
othree_kao committed Feb 25, 2013
1 parent 7f7bbdf commit a7437e071e04e3675271265e77f9bbf9c667936e
View
@@ -44,7 +44,7 @@ function! jslibsyntax#load()
let index = index + 1
endwhile
if loaded > 0
- exe('source '.s:path.'/syntax/postprocess.vim')
+ exe('source '.s:path.'/syntax/postprocess.'.&filetype.'.vim')
endif
endfunction
@@ -0,0 +1,14 @@
+" Vim syntax file
+" Language: JS Lib syntax post process for coffee
+" Maintainer: othree <othree@gmail.com>
+" Last Change: 2013/02/25
+" Version: 0.4
+" URL: https://github.com/othree/javascript-libraries-syntax.vim
+"
+
+syntax cluster coffeeLibraryFuncs contains=@coffeeQFunctions,@coffee_Functions,@coffeeBFunctions,@coffeepFunctions
+syntax cluster coffeeLibraryAttrs contains=@coffeeQAttrs,@coffee_Attrs,@coffeeBAttrs,@coffeepAttrs
+syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w*(\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
+syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w* \+[0-9A-Za-z_$([{'"]\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
+syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w* \([-=]>\)\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
+syntax match coffeeLAttrs /[0-9A-Za-z_$)]\.\h\w*/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryAttrs transparent
@@ -0,0 +1,12 @@
+" Vim syntax file
+" Language: JS Lib syntax post process for javascript
+" Maintainer: othree <othree@gmail.com>
+" Last Change: 2013/02/25
+" Version: 0.4
+" URL: https://github.com/othree/javascript-libraries-syntax.vim
+"
+
+syntax cluster javascriptLibraryFuncs contains=@javascriptQFunctions,@javascript_Functions,@javascriptBFunctions,@javascriptpFunctions,@javascriptAFunctions
+syntax cluster javascriptLibraryAttrs contains=@javascriptQAttrs,@javascript_Attrs,@javascriptBAttrs,@javascriptpAttrs,@javascriptAAttrs
+syntax match javascriptLMethods /[0-9A-Za-z_$)]\.\h\w*(\@=/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryFuncs transparent
+syntax match javascriptLAttrs /[0-9A-Za-z_$)]\.\h\w*/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryAttrs transparent
@@ -0,0 +1,28 @@
+" Vim syntax file
+" Language: JS Lib syntax post process for ls
+" Maintainer: othree <othree@gmail.com>
+" Last Change: 2013/02/25
+" Version: 0.4
+" URL: https://github.com/othree/javascript-libraries-syntax.vim
+"
+
+syntax cluster lsLibraryFuncs contains=@lsQFunctions,@ls_Functions,@lsBFunctions,@lspFunctions
+syntax cluster lsLibraryAttrs contains=@lsQAttrs,@ls_Attrs,@lsBAttrs,@lspAttrs
+" ).fun!
+" ).fun()
+" fun0!fun!
+" fun0!fun()
+" obj.fun!
+" obj.fun()
+syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w*[(!]\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
+" ).fun arg
+" !fun arg
+" obj.fun arg
+syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w* \+[0-9A-Za-z_$([{\'"]\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
+" ).fun funarg
+" !fun funarg
+" obj.fun funarg
+syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w* \(!\?[~-]>\)\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
+syntax match lsLPipe /|>/ containedin=ALLBUT,lsComment skipwhite nextgroup=@lspFunctions
+syntax match lsLCompose />>/ containedin=ALLBUT,lsComment skipwhite nextgroup=@lspFunctions
+syntax match lsLAttrs /\([0-9A-Za-z_$][.!]\|)\.\)\h\w*/ containedin=ALL contains=@lsLibraryAttrs transparent
@@ -0,0 +1,12 @@
+" Vim syntax file
+" Language: JS Lib syntax post process for typescript
+" Maintainer: othree <othree@gmail.com>
+" Last Change: 2013/02/25
+" Version: 0.4
+" URL: https://github.com/othree/javascript-libraries-syntax.vim
+"
+
+syntax cluster javascriptLibraryFuncs contains=@javascriptQFunctions,@javascript_Functions,@javascriptBFunctions,@javascriptpFunctions,@javascriptAFunctions
+syntax cluster javascriptLibraryAttrs contains=@javascriptQAttrs,@javascript_Attrs,@javascriptBAttrs,@javascriptpAttrs,@javascriptAAttrs
+syntax match javascriptLMethods /[0-9A-Za-z_$)]\.\h\w*(\@=/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryFuncs transparent
+syntax match javascriptLAttrs /[0-9A-Za-z_$)]\.\h\w*/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryAttrs transparent
@@ -1,46 +0,0 @@
-" Vim syntax file
-" Language: JS Lib syntax post process
-" Maintainer: othree <othree@gmail.com>
-" Last Change: 2013/02/08
-" Version: 0.1
-" URL: https://github.com/othree/javascript-libraries-syntax.vim
-"
-
-if &filetype == 'javascript'
- syntax cluster javascriptLibraryFuncs contains=@javascriptQFunctions,@javascript_Functions,@javascriptBFunctions,@javascriptpFunctions,@javascriptAFunctions
- syntax cluster javascriptLibraryAttrs contains=@javascriptQAttrs,@javascript_Attrs,@javascriptBAttrs,@javascriptpAttrs,@javascriptAAttrs
- syntax match javascriptLMethods /[0-9A-Za-z_$)]\.\h\w*(\@=/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryFuncs transparent
- syntax match javascriptLAttrs /[0-9A-Za-z_$)]\.\h\w*/ containedin=ALLBUT,javascriptComment contains=@javascriptLibraryAttrs transparent
-endif
-
-if &filetype == 'coffee'
- syntax cluster coffeeLibraryFuncs contains=@coffeeQFunctions,@coffee_Functions,@coffeeBFunctions,@coffeepFunctions
- syntax cluster coffeeLibraryAttrs contains=@coffeeQAttrs,@coffee_Attrs,@coffeeBAttrs,@coffeepAttrs
- syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w*(\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
- syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w* \+[0-9A-Za-z_$([{'"]\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
- syntax match coffeeLMethods /[0-9A-Za-z_$)]\.\h\w* \([-=]>\)\@=/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryFuncs transparent
- syntax match coffeeLAttrs /[0-9A-Za-z_$)]\.\h\w*/ containedin=ALLBUT,coffeeComment contains=@coffeeLibraryAttrs transparent
-endif
-
-if &filetype == 'ls'
- syntax cluster lsLibraryFuncs contains=@lsQFunctions,@ls_Functions,@lsBFunctions,@lspFunctions
- syntax cluster lsLibraryAttrs contains=@lsQAttrs,@ls_Attrs,@lsBAttrs,@lspAttrs
- " ).fun!
- " ).fun()
- " fun0!fun!
- " fun0!fun()
- " obj.fun!
- " obj.fun()
- syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w*[(!]\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
- " ).fun arg
- " !fun arg
- " obj.fun arg
- syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w* \+[0-9A-Za-z_$([{\'"]\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
- " ).fun funarg
- " !fun funarg
- " obj.fun funarg
- syntax match lsLMethods /\([0-9A-Za-z_$][.!]\|)\.\)\h\w* \(!\?[~-]>\)\@=/ containedin=ALLBUT,lsComment contains=@lsLibraryFuncs transparent
- syntax match lsLPipe /|>/ containedin=ALLBUT,lsComment skipwhite nextgroup=@lspFunctions
- syntax match lsLCompose />>/ containedin=ALLBUT,lsComment skipwhite nextgroup=@lspFunctions
- syntax match lsLAttrs /\([0-9A-Za-z_$][.!]\|)\.\)\h\w*/ containedin=ALL contains=@lsLibraryAttrs transparent
-endif

0 comments on commit a7437e0

Please sign in to comment.