Vim definition for disassembly (objdump-d) output file

Source: Internet
Author: User

This article is translated to: http://qiita.com/shiracamus/items/61ffc618f204342e352f

In the CTF (Capture the Flag) it is often necessary to view the results of the objdump-d or-D disassembly x86/x64 binaries, so the relevant tags for VIM are defined here.
Disassembled files are often named *.dis or *.dis-intel, which automatically correspond to the relevant vim definitions when they are opened.

Get a git repository.
Https://github.com/shiracamus/vim-syntax-x86-objdump-d ~/.vim/filetype.vim

Augroup filetypedetect
        au bufread,bufnewfile *.dis* setfiletype dis
augroup END
~/.vim/syntax/dis.vim
"Vim syntax file" language:x86/x64 GNU disassembler (objdump-d-mintel) "Maintainer: @shiracamus <shiracamus @gmail .com> ' last change:2013 Dec ' for version 5.x:clear all syntax items ' for version 6.0 and later:quit WH En a syntax file was already loaded if version < syntax clear ElseIf exists ("B:current_syntax") finish endif L ET s:cpo_save = &AMP;CPO set cpo&vim syn case ignore syn match disoffset "[+-]" syn match disnumber "[+-]\?\ <0x[0-9a-f]\+\> "Contains=disoffset syn match Disnumber" [+-]\?\<[0-9a-f]\+\> "Contains=disoffset syn Mat Ch Disregister "\<[re]\? [ABCD] [xhl]\> "syn match Disregister" \<[re]\? [sd]il\?\> "syn match Disregister" \<[re]\? [sbi]pl\?\> "syn match Disregister" \<r[0-9]\+[dwb]\?\> "syn match Disregister" [^\t]\<[cdefgs]s\> "hs=s +1 syn match Disat "@" syn match dissection "\. [A-z] [a-z_\.-]*: "He=e-1 syn match dissection" @[a-z0-9_][a-z0-9_-]\+ "HS=s+1 contains=disat,disnumber syn match Dislabel "<[a-z0-9_." [a-z0-9_.@+-]\+> "hs=s+1,he=e-1 contains=disnumber,dissection syn match dishexdump": \t\ ([0-9a-f][0-9a-f] \) \+ "hs=     S+1 syn match diserror "<internal disassembler error>" syn match Diserror "(bad)" SYN keyword Distodo contained TODO SYN region discomment start= "/\*" end= "\*/" Contains=distodo syn match discomment "[#;!|]. * "Contains=dislabel,distodo SYN match disspecial display contained" \\\ (x\x\+\|\o\{1,3}\|. \|$\) "Syn region disstring start=+" + skip=+\\\\\|\\ "\|\\$+ excludenl end=+" + end=+$+ keepend contains=disspecial syn R Egion disstring start=+ ' + skip=+\\\\\|\\ ' \|\\$+ excludenl end=+ ' + end=+$+ keepend contains=disspecial syn match DisFor      Mat ": \+file format" syn match Distitle "^[^]\+: \+file format. *$" Contains=disformat syn match Dismacro "Fword" syn match Dismacro "QWORD" syn match Dismacro "DWORD" syn match Dismacro "BYTE" syn matchDismacro "PTR" syn match disdata ". Word" syn match disdata ". Short" syn Match Disdata ". Byte" "O Pecode matched disnumber syn match Disopecode "\<add" syn match Disopecode "\&LT;ADC" syn Match Disopecode " \<dec "syn match Disopecode" \<fadd "syn case Match" Define the default highlighting. " For version 5.7 and earlier:only if not done already "for version 5.8 and later:only when an item doesn ' t has Highli ghting Yet if version >= 508 | |  !exists ("Did_dis_syntax_inits") if version < 508 let did_dis_syntax_inits = 1 command-nargs=+ hilink hi link <args> Else command-nargs=+ hilink hi def link <args> endif "The default methods for Highlightin G. Can be overridden later "Comment hilink discomment Comment" constant:string, Character, number, Boolean, Float hilink disnumber number hilink disstring String "identifier:function hilink dishexdump Ident Ifier "Statement:conditional, Repeat, label, Operator, Keyword, Exception hilink dislabel Label "Preproc:include, De Fine, macro, Precondit hilink disdata Define hilink dismacro Macro "Type:storageclass, Structure, TYP Edef hilink disregister storageclass hilink distitle Typedef "Special:specialchar, Tag, Delimiter, Specia
  Lcomment, Debug hilink disspecial specialchar hilink dissection Special "underlined" Ignore "Error 

Hilink diserror Error "Todo hilink distodo todo delcommand hilink endif let b:current_syntax =" dis "
 Let &AMP;CPO = S:cpo_save unlet s:cpo_save "Vim:ts=8 sts=4 sw=2

The final effect is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.