summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild1
-rw-r--r--ftdetect/polyglot.vim1
-rw-r--r--syntax/jasmine.vim34
-rw-r--r--test_spec.js5
4 files changed, 41 insertions, 0 deletions
diff --git a/build b/build
index 46e86031..8287afe1 100755
--- a/build
+++ b/build
@@ -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);
+ });
+});