From a13d8f8643552050e396d37b5a6c2f0a05158c4f Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 5 Feb 2013 14:25:38 +0100 Subject: Add dts syntax highlighting Taken from https://github.com/b4winckler/macvim/blob/master/runtime/syntax/dts.vim --- .vim/syntax/dts.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .vim/syntax/dts.vim diff --git a/.vim/syntax/dts.vim b/.vim/syntax/dts.vim new file mode 100644 index 0000000..145761a --- /dev/null +++ b/.vim/syntax/dts.vim @@ -0,0 +1,26 @@ +" Vim syntax file +" Language: dts/dtsi (device tree files) +" Maintainer: Daniel Mack +" Last Change: 2012 Oct 04 + +if exists("b:current_syntax") + finish +endif + +syntax region dtsComment start="/\*" end="\*/" +syntax match dtsReference "&[[:alpha:][:digit:]_]\+" +syntax region dtsBinaryProperty start="\[" end="\]" +syntax match dtsStringProperty "\".*\"" +syntax match dtsKeyword "/.*/" +syntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:" +syntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinaryProperty,dtsStringProperty,dtsComment +syntax region dtsCommentInner start="/\*" end="\*/" + +hi def link dtsCellProperty Number +hi def link dtsBinaryProperty Number +hi def link dtsStringProperty String +hi def link dtsKeyword Include +hi def link dtsLabel Label +hi def link dtsReference Macro +hi def link dtsComment Comment +hi def link dtsCommentInner Comment -- cgit v1.2.3-54-g00ecf From 4686141ba18734b748a42b7132b4fe470eebd880 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 5 Feb 2013 14:30:03 +0100 Subject: Hook up dts syntax highlighting --- .vim/filetype.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vim/filetype.vim b/.vim/filetype.vim index ee3a3d8..9a53b1a 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -612,6 +612,9 @@ au BufNewFile,BufRead *.dsl setf dsl " DTD (Document Type Definition for XML) au BufNewFile,BufRead *.dtd setf dtd +" DTS/DTSI (device tree files) +au BufNewFile,BufRead *.dts,*.dtsi setf dts + " EDIF (*.edf,*.edif,*.edn,*.edo) au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif -- cgit v1.2.3-54-g00ecf From 21e2fa2ad06ee16537321cffb9c50145a6739509 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 16 May 2013 22:52:01 +0200 Subject: Add syntax highlighting for bpf (taken from netsniff-ng) --- .vim/filetype.vim | 3 +++ .vim/syntax/bpf.vim | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .vim/syntax/bpf.vim diff --git a/.vim/filetype.vim b/.vim/filetype.vim index 9a53b1a..19d191c 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -271,6 +271,9 @@ au BufNewFile,BufRead *.bdf setf bdf " BibTeX bibliography database file au BufNewFile,BufRead *.bib setf bib +" Berkley Packet Filter +au BufRead,BufNewFile *.bpf setf bpf + " BibTeX Bibliography Style au BufNewFile,BufRead *.bst setf bst diff --git a/.vim/syntax/bpf.vim b/.vim/syntax/bpf.vim new file mode 100644 index 0000000..bb6322a --- /dev/null +++ b/.vim/syntax/bpf.vim @@ -0,0 +1,45 @@ +" Vim syntax file +" Language: Berkeley Packet Filter +" Maintainer: Daniel Borkmann +" Latest Revision: 08/16/2011 +" +" In order to make syntax highlighting for BPFs work in vim, copy this file +" to ~/.vim/syntax/ and activate it in vim by entering: +" +" :set syntax=bpf +" +" If you want to automatically load the BPF syntax highlighting for *.bpf +" files create the ~/.vim/filetype.vim with the following content: +" +" my filetype file +" if exists("did_load_filetypes") +" finish +" endif +" +" augroup filetypedetect +" au! BufRead,BufNewFile *.bpf setfiletype bpf +" augroup END +" + +if exists("b:current_syntax") + finish +endif + +syn keyword bpfTodo contained TODO FIXME XXX NOTE +syn keyword bpfKeywords ldb ldh ld ldi ldx ldxi ldxb st stx jmp ja jeq jneq jne skipwhite +syn keyword bpfKeywords jlt jle jgt jge jset add sub mul div mod neg and or xor skipwhite +syn keyword bpfKeywords lsh rsh ret tax txa skipwhite + +syn match bpfLabel /[a-zA-Z0-9_]\+/ +syn match bpfSpChar /[:,#\[\]\(\)+*&]\?/ contains=bpfNumber,bpfLabel +syn match bpfNumber /\(0[xX]\x\+\|\d\+\)/ +syn match bpfComment ";.*$" contains=bpfTodo + +hi def link bpfTodo Todo +hi def link bpfComment Comment +hi def link bpfKeywords Keyword +hi def link bpfLabel Type +hi def link bpfNumber Number +hi def link bpfSpChar Special + +let b:current_syntax = "bpf" -- cgit v1.2.3-54-g00ecf