开发者

Gvim Syntax Customization

开发者 https://www.devze.com 2023-01-30 05:20 出处:网络
How can I make Gvim to treat(syntax highlighting) lines starting with 开发者_运维知识库# and ; in an assembly file as comment ? Meaning in addition to ; (which is normally the way to represent comment

How can I make Gvim to treat(syntax highlighting) lines starting with 开发者_运维知识库# and ; in an assembly file as comment ? Meaning in addition to ; (which is normally the way to represent comment in assembly)


If the file is being recognised as Assembler, it will have it; $VIMRUNTIME/syntax/asm.vim has the line syn match asmComment "[#;!|].*" contains=asmTodo which matches # lines as comments.

Going by the contents of Vim 7.3's $VIMRUNTIME/filetype.vim, .asm, .s, .S, .a, .A, .mac and .lst files will all be recognised as Assembler. If you are having a different extension, look at :set ft to see what it's being recognised. You may need to override it in your ~/.vimrc:

augroup filetypedetect
    au BufNewFile,BufRead *.whatever setf asm
augroup END


On you installation, you have a file called syntax\asm.vim which should define color syntax rules for assembly.

On my installation, I got the following line:
syn match asmComment "[#;!|].*" contains=asmTodo

Which means that lines starting by # (or ;) should be considered as comments and it does work on my installation.

You can check in filetype.vim if the file you are working on is recognized as asm.

In your .vimrc or .gvimrc which are vim configuration files, you need :
" Syntax highlighting and filetypes
filetype plugin indent on
syntax on

0

精彩评论

暂无评论...
验证码 换一张
取 消