From 8eca7f3e6a9a1620541da61734d3e6c851b2bb69 Mon Sep 17 00:00:00 2001 From: jackofspades707 Date: Tue, 2 Jan 2018 07:31:05 -0800 Subject: [PATCH 1/4] [!] vim-markdown-preview.vim Added global variable for custom browser refresh key mapping --- plugin/vim-markdown-preview.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index 9b02d79..df5be40 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_fresh_key") + let g:vim_markdown_preview_browser_fresh_key="F5" +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_fresh_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_fresh_key) call system('xdotool windowactivate ' . curr_wid) endif endif From 118439d7ba7686182abd5fca23b84ad139ed2604 Mon Sep 17 00:00:00 2001 From: jackofspades707 Date: Tue, 2 Jan 2018 20:07:45 -0800 Subject: [PATCH 2/4] [!] vim-markdown-preview.vim Changed custom browser refresh key binding to repos original default --- plugin/vim-markdown-preview.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index df5be40..fa78884 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -59,7 +59,7 @@ if !exists("g:vim_markdown_preview_hotkey") endif if !exists("g:vim_markdown_preview_browser_fresh_key") - let g:vim_markdown_preview_browser_fresh_key="F5" + let g:vim_markdown_preview_browser_fresh_key="ctrl+r" endif function! Vim_Markdown_Preview() From 6c8dd94d58496ec3534a0271f64d7d865609d702 Mon Sep 17 00:00:00 2001 From: jackofspades707 Date: Tue, 2 Jan 2018 20:10:38 -0800 Subject: [PATCH 3/4] [!] plugin/vim-markdown-preview.vim Fixed typo --- plugin/vim-markdown-preview.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index fa78884..dcb66e9 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -58,8 +58,8 @@ if !exists("g:vim_markdown_preview_hotkey") let g:vim_markdown_preview_hotkey='' endif -if !exists("g:vim_markdown_preview_browser_fresh_key") - let g:vim_markdown_preview_browser_fresh_key="ctrl+r" +if !exists("g:vim_markdown_preview_browser_refresh_key") + let g:vim_markdown_preview_browser_refresh_key="ctrl+r" endif function! Vim_Markdown_Preview() @@ -90,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" . g:vim_markdown_preview_browser_fresh_key) + call system("xdotool key" . g:vim_markdown_preview_browser_refresh_key) call system('xdotool windowactivate ' . curr_wid) endif endif @@ -144,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" . g:vim_markdown_preview_browser_fresh_key) + call system("xdotool key" . g:vim_markdown_preview_browser_refresh_key) call system('xdotool windowactivate ' . curr_wid) endif endif From 091bb3cd946317f1a7372be7081c2924994fb102 Mon Sep 17 00:00:00 2001 From: jackofspades707 Date: Tue, 2 Jan 2018 20:13:46 -0800 Subject: [PATCH 4/4] [!] README.md Updated readme to reflect documentation for new global variable --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) 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