about summary refs log tree commit diff stats
path: root/cpp/vimrc.vim
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/vimrc.vim')
-rw-r--r--cpp/vimrc.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/vimrc.vim b/cpp/vimrc.vim
new file mode 100644
index 00000000..65fd4575
--- /dev/null
+++ b/cpp/vimrc.vim
@@ -0,0 +1,18 @@
+" Highlighting wart's literate directives in C++ sources.
+function! HighlightTangledFile()
+  if &ft == ""
+    set ft=cpp
+  endif
+  syntax region wartTangle start=+:(+ skip=+".*"+ end=+)+
+  highlight link wartTangle Delimiter
+  syntax region wartTrace start="^+" end="$"
+  highlight wartTrace ctermfg=darkgreen
+  syntax region wartTraceAbsent start="^-" end="$"
+  highlight wartTraceAbsent ctermfg=darkred
+  syntax region wartTraceResult start="^=>" end="$"
+  highlight wartTraceResult ctermfg=darkgreen cterm=bold
+  syntax region wartComment start="# " end="$"
+  highlight link wartComment Comment
+endfunction
+call HighlightTangledFile()
+autocmd BufReadPost,BufNewFile 0* call HighlightTangledFile()