Skip to content

Instantly share code, notes, and snippets.

@klodio
Created June 18, 2012 05:07
Show Gist options
  • Save klodio/2946939 to your computer and use it in GitHub Desktop.
Save klodio/2946939 to your computer and use it in GitHub Desktop.
Add this to your vimrc (or make it a vim plugin) if you use ImpactJS
"I know it's obvious, but those mappings require FileType (just remove "au FileType " if you don't have it)
"type igm tab to start a module
"I'd like to use zencoding instead of those hacks, but no time for now :)
au FileType javascript inoremap igm<Tab> ig.module(<CR>'game.entities.<C-R>=expand("%:t:r")<CR>'<CR>).requires(<CR>''<CR>).defines(function(){<CR><CR>});<Esc>3k$hi
au FileType javascript inoremap igc<Tab> =ig.Class.extend({<CR>init: function(){<CR><Tab><CR>}<CR>});<Esc>4kI
"will actually insert the filename there, so you won't go crazy figuring out what's missing (but I didn't replace dashes by caps, no time now!)
au FileType javascript inoremap ige<Tab> =ig.Entity.extend({<CR>type:ig.Entity.TYPE.NONE,<CR>checkAgainst:ig.Entity.TYPE.NONE,<CR>collides: ig.Entity.COLLIDES.NEVER,<CR><CR>size:{x:8,y:8},<CR><CR>animSheet: new ig.AnimationSheet( 'media/sprite<C-R>=expand("%:t:r")<CR>.png', 8, 8 ),<CR><CR>init: function(x,y,settings){<CR>this.parent( x, y, settings );<CR>this.addAnim( 'idle', 1, [0] );<CR>},<CR><CR>update: function(){<CR>this.parent();<CR>}<CR>});<Esc>17kI<C-R>=expand("%:t:r")<CR><Esc>bguw~l<Esc>IEntity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment