Da Fish in Sea

These are the voyages of Captain Observant

Vim 4 Flash

| Comments

For about a year, I’ve been using Vim for Flex and Flash development. At work, on Ubuntu, I use gvim; at home on the Mac I use MacVim . I’ve gradually customized my environment so that I now have a pretty nice workflow. So I’m going to share some of the things I’ve learned, as well as some of the scripts I have found, or written. This will be a series of posts.. I’m assuming some knowledge of vim and Flash development here. The best book I’ve found on vim is this one.

Filetype

I can’t remember if there was an actionscript filetype entry originally, but if not you’ll need to create it, and some other entries in filetype.vim.. might as well create one for PixelBender, which I’ve associated with C, since there is currently no syntax file for PixelBender (on my todo list).

"Actionscript
au BufNewFile,BufRead *.as          setf actionscript

"MXML - 
au BufNewFile,BufRead *.mxml        setf mxml

"pixel bender - using c syntax
au BufNewFile,BufRead *.pbk         call s:FTlpc()

Filetype Plugins

Actionscript

actionscript.vim

MXML

  1. syntax file by Abdul Qabiz
  2. However I’m using a simpler one which just pulls in xml syntax, except for CDATA sections.. It’s so short I’m just going to print it here.. can’t remember where I got it from

    if exists("b:current_syntax")
    "         finish
    endif
    
    
    if !exists("main_syntax")
        let main_syntax = 'mxml'
    endif
    
    
    runtime! syntax/xml.vim
    unlet b:current_syntax
    
    
    if filereadable(expand("<sfile>:p:h")."/actionscript.vim")
            unlet! b:current_syntax
             syn include @vimActionScript <sfile>:p:h/actionscript.vim
              syn region actionScript start=+<!\[CDATA\[+ end=+\]\]>+ contains=@vimActionScript
    endif
    

If you are using xml.vim, you can simply symlink .vim/ftplugin/mxml.vim to it.

Colorscheme

This is a matter of personal taste.. my favorite is vividchalk.vim . I modified it slightly to not use italics, which are not available in my favorite font, Monaco. I just commented out the line, around 150. “hi Comment gui=italic

So my actionscript code looks like this ( I like my code big and readable):

There’s still a lot more to cover, but I think I’ll just leave it there for now… stay tuned for more.