HealsCodes / vim-gas

Advanced syntax highlighting for GNU As
BSD 3-Clause "New" or "Revised" License
143 stars 21 forks source link

how to enable this? #1

Closed howhow closed 9 years ago

howhow commented 10 years ago

I download it with git clone, I saw it need add:

/* vim: ft=gas : */

in each source file? I looked you readme, and it said I can also use: hi def link gasOpcodeX86_PENT_SSE

what is the format of ? like: hi def link gasOpcodeX86_PENT_SSE base

HealsCodes commented 10 years ago

You install as by the README (git clone and then put the file into your vim's syntax directory). To set the syntax for one file you put that modeline on the bottom of your file:

/* vim: ft=gas :
*/

TL;DR; - That about is all that's needed to enable this.

If you like more details read on.. The modeline above wille set the syntax each time you open the file so you may need to reload it once when you add that line. (Or type <ESC>:syntax gas<Enter> to change the active syntax on the fly)

The other part is the configurable highlight groups. Without any extra configuration all opcodes are linked to the highlighting for 'Keyword'. If you want to disable a group of opcodes - lets say everything SSE related you would add a line like this to your .vimrc:

" mark SSE opcodes as errors
let g:gasDisableOpcodes='sse'

This will cause all opcodes belonging to the SSE instruction set to be highlighted as 'Error'. That sums up the default highlighting features.

What's also possible is to change the highlighting for one set of opcodes. Lets say you want to highlight Pentium-SSE opcodes not as 'Keyword' but as 'Identifier' then you would add a line like this to your .vimrc:

" highlight Pentium-SSE opcodes as Identifier instead of keyword
hi def link gasOpcodeX86_PENT_SSE Identifier

I provide this as a convenience but the whole syntax looks best if you don't parts of the highlighting.