Permalink
Browse files

Added the ability to do syntax highlighting for html and markdown blo…

…g posts
  • Loading branch information...
1 parent ca6273d commit 448378df72936e92d160e54aab48d01ce70c5cf6 @sudar sudar committed Apr 25, 2013
Showing with 17 additions and 1 deletion.
  1. +3 −1 plugin/vimrepress.py
  2. +1 −0 syntax/{blogsyntax.vim → html_blogsyntax.vim}
  3. +13 −0 syntax/md_blogsyntax.vim
View
@@ -461,9 +461,11 @@ def refresh_from_wp(self, post_id):
if field["key"] == G.CUSTOM_FIELD_KEY:
meta['editformat'] = "Markdown"
self.raw_text = content = field["value"]
+ vim.command('setl syntax=md_blogsyntax')
break
else:
self.raw_text = content
+ vim.command('setl syntax=html_blogsyntax')
meta["content"] = content
@@ -611,7 +613,7 @@ def blog_wise_open_view():
vim.command('setl nomodified')
else:
vim.command(":new")
- vim.command('setl syntax=blogsyntax')
+ vim.command('setl syntax=md_blogsyntax')
vim.command('setl completefunc=vimrepress#CateComplete')
@@ -3,6 +3,7 @@ if version < 600
elseif exists("b:current_syntax")
finish
endif
+runtime! syntax/html.vim
sy match blogeditorEntry "^ *[0-9]*\t.*$"
sy match blogeditorComment '^".*$'
sy match blogeditorIdent '^"[^:]*:'
View
@@ -0,0 +1,13 @@
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+runtime! syntax/markdown.vim
+sy match blogeditorEntry "^ *[0-9]*\t.*$"
+sy match blogeditorComment '^".*$'
+sy match blogeditorIdent '^"[^:]*:'
+hi link blogeditorComment Comment
+hi link blogeditorEntry Directory
+hi link blogeditorIdent Function
+let b:current_syntax = "blogsyntax"

0 comments on commit 448378d

Please sign in to comment.