Browse files

Merge branch 'slow-option' of https://github.com/chreekat/vim-instant…

  • Loading branch information...
2 parents 4c8b300 + df0c47d commit 174bcbcd925f1142bafb0ece1cc5903746e32e3f @suan committed with Suan-Aik Yeo Dec 6, 2012
Showing with 20 additions and 1 deletion.
  1. +10 −0 README.md
  2. +10 −1 after/ftplugin/markdown/instant-markdown.vim
View
10 README.md
@@ -16,6 +16,16 @@ You first need to have Ruby with RubyGems, and node.js with npm installed. (In t
- Copy the `after/ftplugin/markdown/instant-markdown.vim` file from this repo into your `~/.vim/after/ftplugin/markdown/` (creating directories as necessary), or use pathogen.
- Open a markdown file in vim and enjoy!
+Configuration
+-------------
+By default, vim-instant-markdown will update the display in realtime. If that taxes your system, you can specify
+
+```
+let g:instant_markdown_slow = 1
+```
+
+before loading the plugin. This will cause vim-instant-markdown to only refresh on the following events: `CursorHold`, `CursorHoldI`, `InsertLeave`, and `BufWrite`.
+
Supported Platforms
-------------------
OSX and Unix/Linuxes*.
View
11 after/ftplugin/markdown/instant-markdown.vim
@@ -1,3 +1,8 @@
+" # Configuration
+if !exists('g:instant_markdown_slow')
+ let g:instant_markdown_slow = 0
+endif
+
" # Utility Functions
" Simple system wrapper that ignores empty second args
function! s:system(cmd, stdin)
@@ -95,7 +100,11 @@ endfu
aug instant-markdown
au! * <buffer>
au BufEnter <buffer> call s:refreshView()
- au CursorHold,CursorHoldI,CursorMoved,CursorMovedI <buffer> call s:temperedRefresh()
+ if g:instant_markdown_slow
+ au CursorHold,BufWrite,InsertLeave <buffer> call s:temperedRefresh()
+ else
+ au CursorHold,CursorHoldI,CursorMoved,CursorMovedI <buffer> call s:temperedRefresh()
+ endif
au BufWinLeave <buffer> call s:popMarkdown()
au BufwinEnter <buffer> call s:pushMarkdown()
aug END

0 comments on commit 174bcbc

Please sign in to comment.