Very simple live preview plugin for AsciiDoc PDF documents. HTML live preview is perfect with the browser plugins, but for PDF documents there’s nothing available.
This is a plugin I made for my own use, so I’ve only tested it on neovim nightly 0.5. Feel free to open an issue or pull request to fix anything on your system. This is my first vim plugin ever as well, so there’s probably lots to improve.
Plug 'marioortizmanero/adoc-pdf-live.nvim'
use {
'marioortizmanero/adoc-pdf-live.nvim',
config = "require('adoc_pdf_live').setup()"
}
You must setup the plugin in order to use it. For the basic setup with the default options:
require('adoc_pdf_live').setup()
Or, to specify your own custom options (the example lists the default values):
require('adoc_pdf_live').setup {
enabled = false,
-- The viewer command must be like `command <file>`
viewer = 'zathura',
binary = 'asciidoctor-pdf',
params = '',
debug = false,
style = '',
style_regex = 'style\\.ya?ml'
}
See the configuration section in the documentation for more information about the available options.
Once you have an AsciiDoc file open, you can use the :AdocPdfLiveStart
command
to compile the document whenever the file is saved. :AdocPdfLiveOpen
will
additionally open your preferred PDF viewer, and :AdocPdfLiveStop
will stop
the plugin. For more commands, see its section in the documentation.
It’s highly recommended to use a PDF viewer like zathura which automatically reloads the file when it’s modified, so that the live reloading is seamless.
Yaml
style files are roughly supported. This plugin will automatically look for one
and enable it when compiling the PDF, with the style_regex
option. You can
override it with the style
option or the :AdocPdfLiveStyle STYLE
command.