vim2pmpm: markdown preview for vim using pmpm
Forked from suan/vim-instant-markdown on 2020-04-30; original copyright and license notices are preserved in LICENSE and the same Apache License 2.0 applies to this repository; all changes are documented.
Trims down the original by a) removing unused functionality and configuration parameters and b) dropping support for and reference to the Node.js markdown preview server in favour of pmpm that supports Pandoc's Markdown.
vim2pmpm: markdown preview for vim using pmpm
Pipes to pmpm, which serves an html preview of the active buffer's markdown.
-
Install pmpm
-
For vim-plug, add the following to your
.vimrc:Plug 'sweichwald/vim2pmpm', {'for': 'markdown'} filetype plugin on
-
Configuration (defaults shown below):
"let g:pmpm_slow = 0 "let g:pmpm_autostart = 1 "let g:pmpm_autostop = 0 "let g:pmpm_port = 9877
By default, vim2pmpm will update the display frequently. If that taxes your system too much, you can specify
let g:pmpm_slow = 1before loading the plugin (for example place that in your ~/.vimrc). This will cause vim2pmpm to only refresh on the following events:
- No keys have been pressed for a while
- A while after you leave insert mode
- You save the file being edited
By default, vim2pmpm will automatically launch (and not automatically close) the preview server when you open (or close, respectively) a markdown file. If you want to manually control this behavior, you can specify
let g:pmpm_autostart = 0
let g:pmpm_autostop = 1in your .vimrc. You can always manually trigger preview via the command
:PMPMStart and stop it via :PMPMStop.
Choose a custom port for the pmpm websocket server instead of the default 9877.
let g:pmpm_port = 9877