M README.md => README.md +6 -4
@@ 11,22 11,24 @@ Installation<a name='installation'></a>
============
1. With Pathogen: Place `vim-markdown-preview/` in `.vim/bundle/`.
-2. Default browsers:
+2. To remap Control-p to a different hotkey, place the following in your `.vimrc`, replacing `p`:
+ * `let vim_markdown_preview_hotkey='<C-p>'`
+3. Default browsers:
* OS X: Safari
* Unix: Google Chrome
* To change browsers, place the following in your `.vimrc` and replace `'Google Chrome'`:
* `let vim_markdown_preview_browser='Google Chrome'`
-3. Defaults to keeping rendered `.html` file.
+4. Defaults to keeping rendered `.html` file.
* To remove the rendered preview, after loading it in a browser, add the following to your `.vimrc`:
* `let vim_markdown_preview_temp_file=1`
-4. In combination with the above, defaults to mapping `Ctrl-p` to preview without displaying images.
+5. In combination with the above, defaults to mapping `Ctrl-p` to preview without displaying images.
* To display images with the `Ctrl-p` mapping, add:
* `let vim_markdown_preview_toggle=1`
* To display images automatically on buffer write, add:
* `let vim_markdown_preview_toggle=2`
* To disregard images and still automatically preview on buffer write, add:
* `let vim_markdown_preview_toggle=3`
-5. If you prefer [GitHub flavoured markdown](https://help.github.com/articles/github-flavored-markdown/) you need to install [Python grip](https://github.com/joeyespo/grip) and add:
+6. If you prefer [GitHub flavoured markdown](https://help.github.com/articles/github-flavored-markdown/) you need to install [Python grip](https://github.com/joeyespo/grip) and add:
* `let vim_markdown_preview_github=1`
* Note that this makes a request to [GitHub's API](https://developer.github.com/v3/markdown/) (causing latencies) and may require [authentication](https://github.com/joeyespo/grip#access).
* Requires a network connection
M plugin/vim-markdown-preview.vim => plugin/vim-markdown-preview.vim +8 -4
@@ 8,6 8,10 @@ let b:vim_markdown_preview_temp_file = get(g:, 'vim_markdown_preview_temp_file',
let b:vim_markdown_preview_toggle = get(g:, 'vim_markdown_preview_toggle', 0)
let b:vim_markdown_preview_github = get(g:, 'vim_markdown_preview_github', 0)
+if !exists("g:vim_markdown_preview_hotkey")
+ let g:vim_markdown_preview_hotkey='<C-p>'
+endif
+
function! Vim_Markdown_Preview()
let OSNAME = 'Unidentified'
@@ 104,12 108,12 @@ function! Vim_Markdown_Preview_Local()
endfunction
if b:vim_markdown_preview_toggle == 0
- "Maps Ctrl-p to Vim_Markdown_Preview()
- autocmd Filetype markdown,md map <buffer> <C-p> :call Vim_Markdown_Preview()<CR>
+ "Maps vim_markdown_preview_hotkey to Vim_Markdown_Preview()
+ :exec 'autocmd Filetype markdown,md map <buffer> ' . g:vim_markdown_preview_hotkey . ' :call Vim_Markdown_Preview()<CR>'
elseif b:vim_markdown_preview_toggle == 1
- "Display images - Maps Ctrl-p to Vim_Markdown_Preview_Local() - saves the html file locally
+ "Display images - Maps vim_markdown_preview_hotkey to Vim_Markdown_Preview_Local() - saves the html file locally
"and displays images in path
- autocmd Filetype markdown,md map <buffer> <C-p> :call Vim_Markdown_Preview_Local()<CR>
+ :exec 'autocmd Filetype markdown,md map <buffer> ' . g:vim_markdown_preview_hotkey . ' :call Vim_Markdown_Preview_Local()<CR>'
elseif b:vim_markdown_preview_toggle == 2
"Display images - Automatically call Vim_Markdown_Preview_Local() on buffer write
autocmd BufWritePost *.markdown,*.md :call Vim_Markdown_Preview_Local()