Home

Awesome

vim backbone

Collection of Backbone VIM snippets and templates.

Installation

Install for pathogen

cd ~/.vim/bundle
git clone git://github.com/mklabs/vim-backbone.git

Documentation

work in progess

What it does


vim helpfile generated from backbonejs.org (:h backbone)

Backbone helptags


Snipmates snippets. When filetype is set to javascript, type view<tab>, model<tab> or router<tab>

In insert mode, in a file where filetype=javascript, typing view followed by <tab> will expand to the following snippet:

var MyView = Backbone.View.extend({
  el: '',
  tagName: '',

  events: {

  },

  initialize: function () {

  },

  render: function () {

  }
});

Hitting tab again will iterate through snippets placeholders. See :h snipMate and :h snipMate-placeholders for more infos.


Backbone specific omnicompleter.

:h new-omni-completion.

This could also be called "intellisense", but that is a trademark.

Should auto-complete whenever the text in front of the cursor includes a model (this.model triggers the match). Same for collection, router and view.

It works by inspecting the Backbone.Model.prototype object when completing against a match that triggers model completion. It's not as accurate as it would be in your devtool but should be pretty close.

Use CTRL-X CTRL-U in Insert mode to start the completion, when the cursor in in front of the following:

model.
router.
controller.
view.

The plugin also map the <C-Space> (Ctrl+space) to trigger the same omnicompletion.

In insert mode, in a file where filetype=javascript, typing modelor model. followed by either Ctrl+X Ctrl+U or Ctrl+Space will pop the following menu:

Backbone model omnicompleter


What it should do