assembly vim syntax highlighting
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.
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.
Putting this line in your .vimrc
will set you up with the intel syntax whenever you open an .asm
file :
autocmd BufNew,BufRead *.asm set ft=nasm
I started to write a complete GNU as syntax from scratch.
The syntax file is available from vim.org: GNU as syntax for X86
As well as directly on GitHub: GNU as syntax for X86
In addition to the basic instructions it will recognize the following extended Intel / AMD instructions:
- X86 common instruction set (8086 - 686)
- Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)
- Introduced in Deschutes but necessary for SSE support
- XSAVE group (AVX and extended state)
- Generic memory operations
- New MMX instructions introduced in Katmai
- AMD Enhanced 3DNow! (Athlon) instructions
- Willamette SSE2 Cacheability Instructions
- Willamette MMX instructions (SSE2 SIMD Integer Instructions)
- Willamette Streaming SIMD instructions (SSE2)
- Prescott New Instructions (SSE3)
- VMX Instructions
- Extended Page Tables VMX instructions
- Tejas New Instructions (SSSE3)
- AMD SSE4A
- New instructions in Barcelona
- Penryn New Instructions (SSE4.1)
- Nehalem New Instructions (SSE4.2)
- AMD SSE5 instructions
- Intel SMX
- Geode (Cyrix) 3DNow! additions
- Intel AES instructions
- Intel AVX AES instructions
- Intel AVX instructions
- Intel Carry-Less Multiplication instructions (CLMUL)
- Intel AVX Carry-Less Multiplication instructions (CLMUL)
- Intel Fused Multiply-Add instructions (FMA)
- VIA (Centaur) security instructions
- AMD XOP, FMA4 and CVT16 instructions (SSE5)
- Systematic names for the hinting nop instructions
Here is how it looks like: