Skip to content

Instantly share code, notes, and snippets.

@tobynet
Created May 24, 2012 22:52
Show Gist options
  • Save tobynet/2784723 to your computer and use it in GitHub Desktop.
Save tobynet/2784723 to your computer and use it in GitHub Desktop.
my vim syntax question
" ~/.vim/syntax/markdown.vim
" \c で 大文字小文字無視します :help /\c
" todo: TODO: をハイライトしたい
syntax match myTodo /\ctodo:/
" done: DONE: をハイライトしたい
syntax match myDone /\cdone:/
" 適当に色付け
highlight link myTodo Todo
highlight link myDone Error

TODO: aaaafsdfdsf # FAILED. 先頭だと上手く行かない

TODO: fdfdsfdsfd # OK!!

DONE: dsdaada # OK!!

TODO: DONE: TODO: DONE: # OK!!

DONE: hogegem # FAILED.

  • DONE: # OK!! TODO: # これはCODEなのでハイライトされなくてもOK(できれば対応したい)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/dev/markdown/test.mkd.html</title>
<meta name="Generator" content="Vim/7.3">
<meta name="plugin-version" content="vim7.3_v10">
<meta name="syntax" content="markdown">
<meta name="settings" content="number_lines,use_css,pre_wrap,expand_tabs">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
.lnr { color: #ffff00; }
.Statement { color: #ffff00; }
.Error { color: #ffffff; background-color: #ff6060; font-weight: bold; }
.Todo { color: #808080; background-color: #ffff00; }
-->
</style>
</head>
<body>
<pre>
<span class="lnr"> 1 </span>TODO: aaaafsdfdsf # FAILED. 先頭だと上手く行かない
<span class="lnr"> 2 </span>
<span class="lnr"> 3 </span> <span class="Todo">TODO:</span> fdfdsfdsfd # OK!!
<span class="lnr"> 4 </span>
<span class="lnr"> 5 </span> <span class="Error">DONE:</span> dsdaada # OK!!
<span class="lnr"> 6 </span>
<span class="lnr"> 7 </span> <span class="Todo">TODO:</span> <span class="Error">DONE:</span> <span class="Todo">TODO:</span> <span class="Error">DONE:</span> # OK!!
<span class="lnr"> 8 </span>
<span class="lnr"> 9 </span>DONE: hogegem # FAILED.
<span class="lnr">10 </span>
<span class="lnr">11 </span><span class="Statement">-</span> <span class="Error">DONE:</span> # OK!!
<span class="lnr">12 </span> TODO: # これはCODEなのでハイライトされなくてもOK(できれば対応したい)
</pre>
</body>
<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment