vimassemblyx86vim-syntax-highlighting

assembly vim syntax highlighting


The default assembly syntax file didn't work well and searching the web about gas assembly I found nothing about a gas (AT&T) syntax file for vim. Has anyone found this? I can't write my own syntax file.

http://img168.imageshack.us/img168/46/nasm.png ft=nasm

http://img160.imageshack.us/img160/5857/asm.png ft=asm(default)

http://img164.imageshack.us/img164/8476/tasm.png ft=tasm


Solution

  • This may get you started. Is that more like what you're looking for?

    Just had a quick search - it looks like there are a few different sorts of assembly syntax highlighting built in. Which one are you using?

    Copy-pasted from :help syntax

    Currently these syntax
    files are included:
        asm     GNU assembly (the default)
        asm68k      Motorola 680x0 assembly
        asmh8300    Hitachi H-8300 version of GNU assembly
        ia64        Intel Itanium 64
     fasm Flat assemlby http://flatassembler.net
        masm        Microsoft assembly (probably works for any 80x86)
        nasm        Netwide assembly
        tasm        Turbo Assembly (with opcodes 80x86 up to Pentium, and
                MMX)
        pic     PIC assembly (currently for PIC16F84)
    
    The most flexible is to add a line in your assembly file containing:
        :asmsyntax=nasm
    Replace "nasm" with the name of the real assembly syntax.  This line must be
    one of the first five lines in the file.
    

    This additional syntax script is from vim.org

    It looks like your screenshot is using the default asm filetype. Try

    :set ft=nasm
    

    and you should get some colour changes as per these screenshots.

    ft=nasm

    From your screenshots above I've made a couple of quick modifications to the fasm vim syntax and called it gasm. It can be found here on pastebin.

    Copy and paste that into your personal .vim/syntax or vimfiles/syntax directory and call it gasm.vim Then in your assembly file :set ft=gasm

    This vim script relies on comments being of the form % comment with the space included. You can see this (or change it if you wish) on line 116 of the script.

    Please note: Don't copy the line numbers.