Snippets File for Actionscript 3

I recently discovered the Snipmate plug-in for Vim. It basically lets you “auto-complete” large blocks of code. For instance, you can type “for” then press a key to generate the entire for-loop, or you could type “html” then press a key to generate the entire HTML skeleton. In fact the whole thing is much more clever than that but you have to see it to believe it. Check out a video showing off the plug-in after the fold as well as a custom snippets file targeting Actionscript 3. With this new snippets file you can quickly churn out common code patterns such as for-loops, classes, getters and setters, and much more.

http://www.vimeo.com/3535418

Using this plug-in is pretty straightforward. The only problem I’ve found is that I can’t for the life of me perform some of the really advanced stuff seen in the video. For example, I can’t leave the currently selected snippet and then return and reactivate it. That being said simply having the auto-complete is enough for me. Another nice feature of the plug-in is how easy it is to create a snippet file for a custom file type. In this case I’ve modified the PHP snippet to better suit Actionscript 3. One thing to be aware of when using this snippet is that you need to set up your file type detection so that it recognizes .as files as Actionscript files. Anyway check out the snippet file and let me know if you have any questions or comments!

Related Posts

2 Comments

  1. Posted August 19, 2009 at 6:56 pm | Permalink

    Quite the nifty plugin. I’ve got to work up some guts and really throw myself into vim. It’s something I’ve told myself for years, but I was brought up on Emacs and then nano.

    I’ve heard it’s uber-powerful, but I just can’t seem to get the hang of navigating through a file, I’m always forgetting how to copy and paste, etc.

    I’ll give it a try again. Thanks for the video.

  2. Posted August 19, 2009 at 7:05 pm | Permalink

    Vim definitely has a steep learning curve and I imagine like most things it’s not for everybody. That said if you are going to code for 8+ hours a day 5 days a week then I think that it’s a tool worth learning. The initial investment, while high, will pay out over time as you move to new languages and discover new scenarios.

    If you run into any problems or have general questions feel free to email me. One thing that I’m sure would help would be to check out some of the tips and tricks I’ve found to be effective for vim. Another good idea would be to start with something like my .vimrc and hack it to your needs. You can find both here:

    http://www.anotherearlymorning.com/2008/12/ten-vim-tricks-to-live-by/

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>