VIM: ActionScript and MXML syntax files

I am sharing VIM syntax files for ActionScript and MXML, which  I was about to share last-year, I got lazy after Manish’s post. I hope, these syntax files would provide more (if not better) syntax-highlighting :-)

Click following links to download/see:-

You can refer to Manish’s post to learn how to use these files. Instruction applies to any VIM syntax file.

Credit goes to original creators of actionscript.vim and xml.vim. These files were starting points.

Disclaimer:These files work for me, these are not perfect or clean. I would try to clean up, add more (if any missing) syntax and share whenever I get time.

Technorati Tags: , , , , ,

  • DLikhten

    You rule!!!!
    This is great!
    Now all we need is to modify eclipse java editor to take in syntax from actionscript and eclipse jsp editor to handle MXML (after all it is just like JSPs) and we got a semi-working ide :)

  • Devon

    Quick suggestion on implementing them:
    Add this to your $HOME/.vimrc:
    au BufNewFile,BufRead *.mxml set filetype=mxml
    au BufNewFile,BufRead *.as set filetype=actionscript
    The instructions that are linked to don’t include the mxml line and they don’t work when you’re creating a new file!

  • http://www.geoffreymoller.com Geoff

    Incredibly helpful – thanks!
    For Actionscript 3 within an mxml file script tag, the syntax coloring is different than actionscript in a standalone *.as file – is that your intention (or maybe my environment is messed up :) ?

  • Martin

    Is there a way to enable/add folding on the actionscript syntax file?

  • Burteen

    This is awesome

  • vuthecuong

    It works very well in mxml file with embedded actionscript functions.
    However, when I indent above mxml file (gg=G), the mxml parts indented well but the actionscript funtions code did not being indented at all.
    Does anyone as same as me?
    If indent well, this is perfect :)
    Could anyone tell me how can I indent mxml file with embedded actionscript code?
    thanks and regards

  • http://abdulqabiz.com/blog/ Abdul Qabiz

    @vuthecuong I need to check that and probably fix it.
    @Martin I would check that too.
    Thanks for update.
    -abdul

  • http://www.storypixel.com Sam Wilson

    Very nice stuff, I’m going to try to implement these files today. My dream would be a vim plugin that matches Eclipse (FDT). There is a Ruby vim plugin that allows the functionality of clicking on a class name and doing some key command and you go to that class’s definition. That’s exactly what I’d like to see here, maybe I can learn enough to make that happen.

    • http://www.abdulqabiz.com Abdul Qabiz

      @Sam Thanks. I know, I also wanted a VIM plugin for Eclipse and realized there are couple of such plugins, not really stable and usable. Then I realized, Eclipse is different thing and while using existing VIM plugins for Eclipse, my experience has not been good. It’s like trying to fit something meant for different world into something else.

      However, I would see when one appears.

      -abdul

  • queria

    Hi Abdul.

    Its great … thanks very much!

    Q.

  • morch

    Patch: Let syntax files be stored in ~/.vim/syntax

    I’m sure if I put the syntax files under /usr/share they’d work fine. But when I put them under ~/.vim/syntax, I got this error:

    Error detected while processing /home/pvm/.vim/syntax/mxml.vim:
    line 302:
    E484: Can’t open file /home/pvm/.vim/syntax/dtd.vim

    This patch fixed that for me, allowing me to put the syntax files in my user .vim dir:
    > svn diff
    Index: mxml.vim
    ===================================================================
    — mxml.vim (revision 1527)
    +++ mxml.vim (working copy)
    @@ -299,7 +299,7 @@

    syn keyword xmlDocTypeKeyword contained DOCTYPE PUBLIC SYSTEM
    syn region xmlInlineDTD contained matchgroup=xmlDocTypeDecl start=”[" end="]” contains=@xmlDTD
    -syn include @xmlDTD :p:h/dtd.vim
    +runtime ! syntax/dtd.vim
    unlet b:current_syntax

  • morch

    And I second Geoff’s comment about actionscript inside a CDATA in a MXML file being syntax highlighted differently than in an actionscript file. It looks wierd…

  • http://www.k9stud.com Puppies for Sale

    There is a Ruby vim plugin that allows the functionality of clicking on a class name and doing some key command and you go to that class’s definition.

  • http://www.9breedershappytails.com Orlando Puppies

    Incredibly helpful – thanks!
    For Actionscript 3 within an mxml file script tag, the syntax coloring is different than actionscript in a standalone *.as file – is that your intention (or maybe my environment is messed up :) ?

  • Anon

    thx for your work!