Skip to content

Instantly share code, notes, and snippets.

@glidenote
Created December 22, 2011 14:17
Show Gist options
  • Save glidenote/1510443 to your computer and use it in GitHub Desktop.
Save glidenote/1510443 to your computer and use it in GitHub Desktop.
jekyll.vim.diff
Bundle "csexton/jekyll.vim"
let g:jekyll_path = "~/octopress/source/"
let g:jekyll_post_date = "%Y-%m-%d %H:%M"
let g:jekyll_post_published = "false"
let g:jekyll_prompt_categories = "true"
let g:jekyll_comments = "true"
map <Leader>jn :JekyllPost<CR>
map <Leader>jl :JekyllList<CR>
diff --git plugin/jekyll.vim plugin/jekyll.vim
index 3cd3790..5703219 100644
--- plugin/jekyll.vim
+++ plugin/jekyll.vim
@@ -27,8 +27,8 @@ if !exists('g:jekyll_post_published')
let g:jekyll_post_published = "true"
endif
-if !exists('g:jekyll_post_created')
- let g:jekyll_post_created = ""
+if !exists('g:jekyll_post_date')
+ let g:jekyll_post_date = ""
endif
if !exists('g:jekyll_title_pattern')
@@ -43,6 +43,10 @@ if !exists('g:jekyll_prompt_categories')
let g:jekyll_prompt_categories = ""
endif
+if !exists('g:jekyll_comments')
+ let g:jekyll_comments = ""
+endif
+
function s:esctitle(str)
let str = a:str
let str = tolower(str)
@@ -108,14 +112,15 @@ command! -nargs=0 JekyllList :call JekyllList()
function JekyllPost(title)
let published = g:jekyll_post_published
- let created = g:jekyll_post_created
+ let date = g:jekyll_post_date
let tags = g:jekyll_prompt_tags
let categories = g:jekyll_prompt_categories
+ let comments = g:jekyll_comments
- if created == "epoch"
- let created = localtime()
- elseif created != ""
- let created = strftime(created)
+ if date == "epoch"
+ let date = localtime()
+ elseif date != ""
+ let date = strftime(date)
endif
let title = a:title
if title == ''
@@ -133,14 +138,17 @@ function JekyllPost(title)
exe "e " . g:jekyll_path . "/_posts/" . file_name
let template = ["---", "layout: post", "title: \"" . title . "\"", "published: " . published]
- if created != ""
- call add(template, "created: " . created)
+ if date != ""
+ call add(template, "date: " . date)
endif
if tags != ""
- call add(template, "tags: [" . tags . "]")
- endif
+ call add(template, "tags: " . tags)
+ endif
+ if comments != ""
+ call add(template, "comments: " . comments)
+ endif
if categories != ""
- call add(template, "categories: [" . categories . "]")
+ call add(template, "categories: " . categories )
endif
call extend(template,["---", ""])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment