Skip to content

Commit

Permalink
File type detection and basic syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
blipp committed Jul 31, 2015
0 parents commit 5ea17c2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# vim-spicy

Syntax highlighting for BinPAC++/Spicy grammar files (pac2).
See http://www.icir.org/hilti/ for details.

Currently, the syntax highlighting is very basic.

## Installation

Install like any other Vim plugin, for example using vim-plug.

## License

Distributed under the same terms as Vim itself, see <code>:help license</code>.
1 change: 1 addition & 0 deletions ftdetect/spicy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
au BufRead,BufNewFile *.pac2 setfiletype spicy
4 changes: 4 additions & 0 deletions ftplugin/spicy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
setlocal commentstring=#\ %s
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
46 changes: 46 additions & 0 deletions syntax/spicy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
syn keyword spicyTodo contained TODO XXX FIXME NOTE BUG
syn region spicyComment start="#" end="$"
syn keyword spicyImport module import
syn keyword spicyKeyword
\ type
\ export
\ if
\ switch
\ on
\ var
syn keyword spicyStatement print
syn keyword spicyType
\ addr
\ bitfield
\ bool
\ bytes
\ double
\ enum
\ function
\ int
\ uint8
\ uint16
\ uint32
\ uint64
\ interval
\ iterator
\ list
\ map
\ set
\ sink
\ time
\ tuple
\ unit
\ vector
syn keyword spicyBoolean True False
syn match spicyHexadecimalInt "\<0x\x\+\>"

" Set highlights
hi def link spicyTodo Todo
hi def link spicyComment Comment
hi def link spicyImport Include
hi def link spicyKeyword Keyword
hi def link spicyType Type
hi def link spicyStatement Statement
hi def link spicyBoolean Boolean
hi def link spicyHexadecimalInt Number

0 comments on commit 5ea17c2

Please sign in to comment.