diff --git a/README.md b/README.md index 1923b23..fb9d11c 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,17 @@ Example: Mapping Control M. ```vim let vim_markdown_preview_hotkey='' ``` + +### The `vim_markdown_preview_browser_refresh_key` option + +By default, this plugin maps `ctrl+r` (Control+r) to be forwarded to the specified (or default) browser. This keybinding does not use vim syntax for keys, the keys are emulated with xdotools. + +Defalt: `ctrl+r` + +Example: Changing to F5 +``` +let g:vim_markdown_preview_browser_refresh_key='F5' +``` ### The `vim_markdown_preview_browser` option diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index 9b02d79..dcb66e9 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -58,6 +58,10 @@ if !exists("g:vim_markdown_preview_hotkey") let g:vim_markdown_preview_hotkey='' endif +if !exists("g:vim_markdown_preview_browser_refresh_key") + let g:vim_markdown_preview_browser_refresh_key="ctrl+r" +endif + function! Vim_Markdown_Preview() let b:curr_file = expand('%:p') @@ -86,7 +90,7 @@ function! Vim_Markdown_Preview() let curr_wid = system('xdotool getwindowfocus') call system('xdotool windowmap ' . chrome_wid) call system('xdotool windowactivate ' . chrome_wid) - call system("xdotool key 'ctrl+r'") + call system("xdotool key" . g:vim_markdown_preview_browser_refresh_key) call system('xdotool windowactivate ' . curr_wid) endif endif @@ -140,7 +144,7 @@ function! Vim_Markdown_Preview_Local() let curr_wid = system('xdotool getwindowfocus') call system('xdotool windowmap ' . chrome_wid) call system('xdotool windowactivate ' . chrome_wid) - call system("xdotool key 'ctrl+r'") + call system("xdotool key" . g:vim_markdown_preview_browser_refresh_key) call system('xdotool windowactivate ' . curr_wid) endif endif