M README.md => README.md +4 -2
@@ 1,7 1,7 @@
Vim Markdown Preview
====================
-A vim plugin for previewing markdown files in a browser. This plugin was designed to maintan focus on vim but use Google Chrome to preview rendered markdown. Thus, everything is done in the background so you never have to leave vim.
+A Vim plugin for previewing markdown files in a browser. This plugin was designed to maintain focus on vim but use Google Chrome to preview rendered markdown. Thus, everything is done in the background so you never have to leave Vim.
Installation
============
@@ 16,13 16,15 @@ Requirements
Usage
=====
-When in a *.markdown or *.md file, vim-markdown-preview maps `Ctrl-p` as follows:
+When in a *.markdown or *.md file, vim-markdown-preview does the following on a write to the buffer:
* If you are not previewing the current file:
* Open an html rendered version of your file in Google Chrome in the background.
* Otherwise:
* Refresh your preview of the current markdown file in Google Chrome.
+Uncomment the last line in `plugin/vim-markdown-preview.vim` to map `Ctrl-p` to the above instead of on write.
+
Behind The Scenes
=================
1. First, vim-markdown-preview renders your markdown as html and creates a temporary file `vim-markdown-preview.html` in `/tmp/`.
M plugin/vim-markdown-preview.vim => plugin/vim-markdown-preview.vim +3 -2
@@ 7,7 7,7 @@ function! Vim_Markdown_Preview()
let curr_file = expand('%:t')
call system('markdown ' . curr_file . ' > /tmp/vim-markdown-preview.html')
let chrome_wid = system("xdotool search --name 'vim-markdown-preview.html - Google Chrome'")
- sleep 31m
+ sleep 300m
if !chrome_wid
call system('see -g /tmp/vim-markdown-preview.html')
else
@@ 21,4 21,5 @@ function! Vim_Markdown_Preview()
call system('rm /tmp/vim-markdown-preview.html')
endfunction
-autocmd Filetype markdown,md map <buffer> <C-p> :call Vim_Markdown_Preview()<CR>
+autocmd BufWritePost *.markdown,*.md :call Vim_Markdown_Preview()
+"autocmd Filetype markdown,md map <buffer> <C-p> :call Vim_Markdown_Preview()<CR>