Vim Tips Wiki
Advertisement

Use this page to discuss script 3249 Jasmine snippets: snipMate snippets for the Jasmine JavaScript BDD Framework

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Fixes[]

This doesn't work out of the box; you need to do two things:

1. The file listing has lost its indentation so it flat does not work. For each snippet, you must indent the snippet text that will be generated.

i.e., instead of just copying the list like this:

snippet aft
afterEach(function() {
${1}
}

you need to edit it as:

snippet aft
  afterEach(function() {
  ${1}
  }

2. Since jasmine code is a javascript file, this snippet doesn't get recognized; the javascript snippets file takes over. To define the jasmine snippets file, add this to your .vimrc file:

au BufRead,BufNewFile *[Ss]pec.js filetype=jasmine, syntax=javascript

That way, you'll get the jasmine snippets with javascript highlighting.

Of course, you may also want to use the standard javascript snippets, so that means either including the javascript snippets along with the jasmine snippets, or doing a cut-n-paste. This is left as an exercise for the reader. --August 25, 2012

Comments[]

Advertisement