Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option vim_markdown_preview_temp_delay #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Vim Markdown Preview
- [Hotkey](#hotkey)
- [Browser](#browser)
- [Temp File](#temp)
- [Temp Delay](#tempdelay)
- [Github Flavoured Markdown](#github)
- [Markdown.pl](#perl)
- [Pandoc](#pandoc)
Expand Down Expand Up @@ -130,6 +131,20 @@ Example: Remove the rendered preview.
let vim_markdown_preview_temp_file=1
```

<a name='tempdelay'></a>
### The `vim_markdown_preview_temp_delay` option

The temp file might get deleted too early, when your browser needs a longer time to rendered html file. The browser then shows an errors. This option let's you increase the delay between preview invocation and temp file deletion.

Default: `200m`

Examples: Sleep for 2 seconds
```vim
let vim_markdown_preview_temp_delay='2'
" or in milliseconds
let vim_markdown_preview_temp_delay='2000m'
```

<a name='github'></a>
### The `vim_markdown_preview_github` option

Expand Down
8 changes: 6 additions & 2 deletions plugin/vim-markdown-preview.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ if !exists("g:vim_markdown_preview_temp_file")
let g:vim_markdown_preview_temp_file = 0
endif

if !exists("g:vim_markdown_preview_temp_delay")
let g:vim_markdown_preview_temp_delay = '200m'
endif

if !exists("g:vim_markdown_preview_toggle")
let g:vim_markdown_preview_toggle = 0
endif
Expand Down Expand Up @@ -105,7 +109,7 @@ function! Vim_Markdown_Preview()
endif

if g:vim_markdown_preview_temp_file == 1
sleep 200m
execute 'sleep ' . g:vim_markdown_preview_temp_delay
call system('rm /tmp/vim-markdown-preview.html')
endif
endfunction
Expand Down Expand Up @@ -159,7 +163,7 @@ function! Vim_Markdown_Preview_Local()
endif

if g:vim_markdown_preview_temp_file == 1
sleep 200m
execute 'sleep ' . g:vim_markdown_preview_temp_delay
call system('rm vim-markdown-preview.html')
endif
endfunction
Expand Down