summaryrefslogtreecommitdiffstats
path: root/txr.vim
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-01 03:16:07 -0400
committerKaz Kylheku <kaz@kylheku.com>2011-11-01 03:16:07 -0400
commitf6140553d11d9523dfaff2eac01dcc2621ede45f (patch)
treee6416b70f8686253eaefdbeec96e2b1cbd5b557b /txr.vim
parentd57c2539d8ce40af46050cc16a90165087b9f349 (diff)
downloadtxr-f6140553d11d9523dfaff2eac01dcc2621ede45f.tar.gz
txr-f6140553d11d9523dfaff2eac01dcc2621ede45f.tar.bz2
txr-f6140553d11d9523dfaff2eac01dcc2621ede45f.zip
Syntax highlighting for Vim.
* txr.vim: New file.
Diffstat (limited to 'txr.vim')
-rw-r--r--txr.vim48
1 files changed, 48 insertions, 0 deletions
diff --git a/txr.vim b/txr.vim
new file mode 100644
index 00000000..eb220685
--- /dev/null
+++ b/txr.vim
@@ -0,0 +1,48 @@
+" VIM Syntax file for txr
+" Kaz Kylheku <kaz@kylheku.com>
+" 2011-11-01
+
+syn case match
+syn spell toplevel
+
+syn keyword txr_keyword contained skip trailer freeform block accept fail
+syn keyword txr_keyword contained next some all none maybe cases choose collect
+syn keyword txr_keyword contained flatten forget local merge bind set cat output
+syn keyword txr_keyword contained define try defex throw deffilter filter eof eol
+
+syn match txr_at "@[ \t]*@"
+syn match txr_comment "@#.*"
+syn match txr_contin "@\\$"
+syn match txr_hashbang "^#!.*"
+syn match txr_char "@[ \t]*\\."
+syn match txr_char "@[ \t]*\\x[0-9A-Fa-f]\+"
+syn match txr_char "@[ \t]*\\[0-9]\+"
+syn match txr_variable "@[ \t]*[*]\?[A-Za-z_][A-Za-z0-9_]*"
+
+syn match txr_ident ":\?[A-Za-z_][A-Za-z0-9_]*" contained
+syn match txr_num "[+-]\?[0-9]\+" contained
+
+syn region txr_bracevar matchgroup=Delimiter start="@[ \t]*[*]\?{" matchgroup=Delimiter end="}" contains=txr_ident,txr_num,txr_string,txr_list,txr_regex
+
+syn region txr_directive matchgroup=Delimiter start="@[ \t]*(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_quasilit,txr_num,txr_ident,txr_regex,txr_string
+
+syn region txr_list contained matchgroup=Delimiter start="(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=txr_string,txr_regex,txr_ident,txr_num
+
+syn region txr_string contained oneline start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn region txr_quasilit contained oneline start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=txr_directive,txr_variable,txr_bracevar
+syn region txr_regex contained oneline start=+/+ skip=+\\\\\|\\/+ end=+/+
+syn region txr_regdir oneline start=+@/+ skip=+\\\\\|\\/+ end=+/+
+
+hi def link txr_comment Comment
+hi def link txr_hashbang Comment
+hi def link txr_contin Comment
+hi def link txr_char String
+hi def link txr_keyword Keyword
+hi def link txr_string String
+hi def link txr_quasilit String
+hi def link txr_regex String
+hi def link txr_regdir String
+hi def link txr_variable Identifier
+hi def link txr_bracevar Identifier
+hi def link txr_ident Identifier
+hi def link txr_num Number