Skip to content

Commit

Permalink
initial check-in
Browse files Browse the repository at this point in the history
  • Loading branch information
jwcxz committed Nov 18, 2013
1 parent ad30e86 commit 6bde0b6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
@@ -1,4 +1,23 @@
vim-vdb
=======
vdb syntax
==========

Syntax highlighting for human-readable key:value databases
JWC :: jwcxz.com


This is a simple set of highlighting rules for files consisting of `key:value`
pairs, plus some highlighting for indentation.

Format looks like this:

first level
second level
third level
keytype1: value
keytype2# value

Note that two different symbols are defined: `:` and `#`. It's easy enough to
add some more. I use this to define information that I care about and don't
care about. This usually goes nicely with `fdm=indent`.


![screenshot](https://raw.github.com/jwcxz/vim-vdb/master/vdb.png)
41 changes: 41 additions & 0 deletions syntax/vdb.vim
@@ -0,0 +1,41 @@
" Vim syntax file
" Language: VDB (simple text database)
" Maintainer: Joe Colosimo (jwcxz.com)
" Last Change:
" Vim URL: http://www.vim.org/lang.html

if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif

setlocal iskeyword=a-z,A-Z,48-57,.,_
setlocal isident=a-z,A-Z,48-57,.,_
syn case ignore

syn match vdbH1 "^\([^: ]\)\([^:]*\)$"
syn match vdbH2 "^\(\s\{4\}\)\([^: ]\)\([^:]*\)$"
syn match vdbH3 "^\(\s\{8,\}\)\([^: ]\)\([^:]*\)$"

syn match vdbKey1 "^\([^:#]\+\):\s\?" nextgroup=vdbVal1
syn region vdbVal1 start="." end="$" contained

syn match vdbKey2 "^\([^:#]\+\)#\s\?" nextgroup=vdbVal2
syn region vdbVal2 start="." end="$" contained


hi def link vdbH1 Special
hi def link vdbH2 PreProc
hi def link vdbH3 Type

hi def link vdbKey1 Function
hi def link vdbVal1 String

hi def link vdbKey2 Comment
hi def link vdbVal2 Comment


let b:current_syntax = "vdb"
" vim: ts=4 sw=4 :

Binary file added vdb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6bde0b6

Please sign in to comment.