diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2014-04-15 01:12:18 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-04-15 01:12:18 +0200 |
commit | daa6fc695890085c23851ddb07f313adcd47a50a (patch) | |
tree | 75b7212be3a9c09fd7c5bf7c3b0296ad6d82f5e6 | |
parent | 610f4c570123510f2d6f4c5799d880d8581126cf (diff) | |
download | vim-polyglot-daa6fc695890085c23851ddb07f313adcd47a50a.tar.gz vim-polyglot-daa6fc695890085c23851ddb07f313adcd47a50a.zip |
Add jasmine support
-rwxr-xr-x | build | 1 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 1 | ||||
-rw-r--r-- | syntax/jasmine.vim | 34 | ||||
-rw-r--r-- | test_spec.js | 5 |
4 files changed, 41 insertions, 0 deletions
@@ -83,6 +83,7 @@ PACKS=" haskell:travitch/hasksyn html5:othree/html5.vim jade:digitaltoad/vim-jade + jasmine:glanotte/vim-jasmine javascript:pangloss/vim-javascript json:leshill/vim-json jst:briancollins/vim-jst diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 6fd81d68..b385d1d8 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -48,6 +48,7 @@ autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml autocmd BufNewFile,BufRead *.sass setf sass autocmd BufNewFile,BufRead *.scss setf scss autocmd BufNewFile,BufReadPost *.jade set filetype=jade +autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine au BufNewFile,BufRead *.js setf javascript au BufNewFile,BufRead *.jsm setf javascript au BufNewFile,BufRead Jakefile setf javascript diff --git a/syntax/jasmine.vim b/syntax/jasmine.vim new file mode 100644 index 00000000..3a46a392 --- /dev/null +++ b/syntax/jasmine.vim @@ -0,0 +1,34 @@ +" Syntax highlighting for jasmine specs (used by http://github.com/thomd/vim-jasmine). + +" if b:current_syntax is defined, some other syntax files, earlier in 'runtimepath' was already loaded +if exists("b:current_syntax") + finish +endif + +" match the case of syntax elements +syntax case match + +" keywords +syntax keyword jasmineSuite describe it beforeEach afterEach +syntax keyword jasmineDisabled xdescribe xit +syntax keyword jasmineExpectation expect +syntax region jasmineNot start=/not/ end=/\.to/me=s-1 +syntax match jasmineMatcher /\.to\h\+/ +syntax keyword jasmineSpy spyOn +syntax match jasmineSpyMatcher /and\h\+/ + +" jasmine is a subset of the javascript language, thus we need to activate +" javascript syntax highlighting and add new jasmin group names to the +" JavaScriptAll cluster which is defined there +runtime! syntax/javascript.vim +syntax cluster JavaScriptAll add=jasmineSuite,jasmineDisabled,jasmineExpectation,jasmineNot,jasmineMatcher,jasmineSpy,jasmineSpyMatcher + +let b:current_syntax = "jasmine" + +hi def link jasmineSuite Statement +hi def link jasmineDisabled Error +hi def link jasmineExpectation Statement +hi def link jasmineNot Special +hi def link jasmineMatcher Statement +hi def link jasmineSpy Special +hi def link jasmineSpyMatcher Statement diff --git a/test_spec.js b/test_spec.js new file mode 100644 index 00000000..b7ac4cf5 --- /dev/null +++ b/test_spec.js @@ -0,0 +1,5 @@ +describe("A suite", function() { + it("contains spec with an expectation", function() { + expect(true).toBe(true); + }); +}); |