feat: rename
This commit is contained in:
parent
e1d7abf58e
commit
942438f817
21 changed files with 660 additions and 305 deletions
|
|
@ -1,83 +1,80 @@
|
|||
*render.nvim.txt* Async document compilation for Neovim
|
||||
*preview.nvim.txt* Async document compilation for Neovim
|
||||
|
||||
Author: Raphael
|
||||
License: MIT
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *render.nvim*
|
||||
INTRODUCTION *preview.nvim*
|
||||
|
||||
render.nvim is an extensible framework for compiling documents asynchronously
|
||||
preview.nvim is an extensible framework for compiling documents asynchronously
|
||||
in Neovim. It provides a unified interface for any compilation workflow —
|
||||
LaTeX, Typst, Markdown, or anything else with a CLI compiler.
|
||||
|
||||
The plugin ships with zero provider defaults. Users must explicitly configure
|
||||
their compiler commands. render.nvim is purely an orchestration framework.
|
||||
their compiler commands. preview.nvim is purely an orchestration framework.
|
||||
|
||||
==============================================================================
|
||||
REQUIREMENTS *render.nvim-requirements*
|
||||
REQUIREMENTS *preview.nvim-requirements*
|
||||
|
||||
- Neovim >= 0.10.0
|
||||
- Neovim >= 0.11.0
|
||||
- A compiler binary for each configured provider (e.g. `typst`, `latexmk`)
|
||||
|
||||
==============================================================================
|
||||
INSTALLATION *render.nvim-installation*
|
||||
INSTALLATION *preview.nvim-installation*
|
||||
|
||||
With luarocks (recommended):
|
||||
>
|
||||
:Rocks install render.nvim
|
||||
:Rocks install preview.nvim
|
||||
<
|
||||
|
||||
With lazy.nvim:
|
||||
>lua
|
||||
{
|
||||
'barrettruth/render.nvim',
|
||||
'barrettruth/preview.nvim',
|
||||
}
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *render.nvim-configuration*
|
||||
CONFIGURATION *preview.nvim-configuration*
|
||||
|
||||
Configure via the `vim.g.render` global table before the plugin loads.
|
||||
Configure via the `vim.g.preview` global table before the plugin loads.
|
||||
|
||||
*render.Config*
|
||||
*preview.Config*
|
||||
Fields:~
|
||||
|
||||
`debug` boolean|string Enable debug logging. A string value
|
||||
is treated as a log file path.
|
||||
Default: `false`
|
||||
|
||||
`providers` table Provider configurations keyed by name.
|
||||
Default: `{}`
|
||||
`providers` table Provider configurations keyed by
|
||||
filetype. Default: `{}`
|
||||
|
||||
`providers_by_ft` table Maps filetypes to provider names.
|
||||
Default: `{}`
|
||||
|
||||
*render.ProviderConfig*
|
||||
*preview.ProviderConfig*
|
||||
Provider fields:~
|
||||
|
||||
`cmd` string[] The compiler command (required).
|
||||
|
||||
`args` string[]|function Additional arguments. If a function,
|
||||
receives a |render.Context| and returns
|
||||
receives a |preview.Context| and returns
|
||||
a string[].
|
||||
|
||||
`cwd` string|function Working directory. If a function,
|
||||
receives a |render.Context|. Default:
|
||||
receives a |preview.Context|. Default:
|
||||
git root or file directory.
|
||||
|
||||
`env` table Environment variables.
|
||||
|
||||
`output` string|function Output file path. If a function,
|
||||
receives a |render.Context|.
|
||||
receives a |preview.Context|.
|
||||
|
||||
`error_parser` function Receives (stderr, |render.Context|)
|
||||
`error_parser` function Receives (stderr, |preview.Context|)
|
||||
and returns vim.Diagnostic[].
|
||||
|
||||
`clean` string[]|function Command to remove build artifacts.
|
||||
If a function, receives a
|
||||
|render.Context|.
|
||||
|preview.Context|.
|
||||
|
||||
*render.Context*
|
||||
*preview.Context*
|
||||
Context fields:~
|
||||
|
||||
`bufnr` integer Buffer number.
|
||||
|
|
@ -87,7 +84,7 @@ Context fields:~
|
|||
|
||||
Example:~
|
||||
>lua
|
||||
vim.g.render = {
|
||||
vim.g.preview = {
|
||||
providers = {
|
||||
typst = {
|
||||
cmd = { 'typst', 'compile' },
|
||||
|
|
@ -110,74 +107,117 @@ Example:~
|
|||
return diagnostics
|
||||
end,
|
||||
},
|
||||
latexmk = {
|
||||
tex = {
|
||||
cmd = { 'latexmk' },
|
||||
args = { '-pdf', '-interaction=nonstopmode' },
|
||||
clean = { 'latexmk', '-c' },
|
||||
},
|
||||
},
|
||||
providers_by_ft = {
|
||||
typst = 'typst',
|
||||
tex = 'latexmk',
|
||||
}
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
PRESETS *preview.nvim-presets*
|
||||
|
||||
preview.nvim ships with pre-built provider configurations for common tools.
|
||||
Import them from `preview.presets`:
|
||||
|
||||
`presets.typst` typst compile → PDF
|
||||
`presets.latex` latexmk -pdf → PDF (with clean support)
|
||||
`presets.markdown` pandoc → PDF
|
||||
|
||||
Example:~
|
||||
>lua
|
||||
local presets = require('preview.presets')
|
||||
vim.g.preview = {
|
||||
providers = {
|
||||
typst = presets.typst,
|
||||
tex = presets.latex,
|
||||
markdown = presets.markdown,
|
||||
},
|
||||
}
|
||||
<
|
||||
|
||||
Override individual fields with `vim.tbl_deep_extend`:
|
||||
>lua
|
||||
local presets = require('preview.presets')
|
||||
vim.g.preview = {
|
||||
providers = {
|
||||
typst = vim.tbl_deep_extend('force', presets.typst, {
|
||||
env = { TYPST_FONT_PATHS = '/usr/share/fonts' },
|
||||
}),
|
||||
},
|
||||
}
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
COMMANDS *render.nvim-commands*
|
||||
COMMANDS *preview.nvim-commands*
|
||||
|
||||
:Render [subcommand] *:Render*
|
||||
:Preview [subcommand] *:Preview*
|
||||
|
||||
Subcommands:~
|
||||
|
||||
`compile` Compile the current buffer (default if omitted).
|
||||
`stop` Kill active compilation for the current buffer.
|
||||
`clean` Run the provider's clean command.
|
||||
`status` Echo compilation status (idle or compiling).
|
||||
`watch` Toggle auto-compile on save for the current buffer.
|
||||
`status` Echo compilation status (idle, compiling, watching).
|
||||
|
||||
==============================================================================
|
||||
API *render.nvim-api*
|
||||
API *preview.nvim-api*
|
||||
|
||||
render.compile({bufnr?}) *render.compile()*
|
||||
preview.compile({bufnr?}) *preview.compile()*
|
||||
Compile the document in the given buffer (default: current).
|
||||
|
||||
render.stop({bufnr?}) *render.stop()*
|
||||
preview.stop({bufnr?}) *preview.stop()*
|
||||
Kill the active compilation process for the buffer.
|
||||
|
||||
render.clean({bufnr?}) *render.clean()*
|
||||
preview.clean({bufnr?}) *preview.clean()*
|
||||
Run the provider's clean command for the buffer.
|
||||
|
||||
render.status({bufnr?}) *render.status()*
|
||||
Returns a |render.Status| table.
|
||||
preview.watch({bufnr?}) *preview.watch()*
|
||||
Toggle watch mode for the buffer. When enabled, the buffer is
|
||||
automatically compiled on each save (`BufWritePost`). Call again
|
||||
to stop watching.
|
||||
|
||||
*render.Status*
|
||||
preview.status({bufnr?}) *preview.status()*
|
||||
Returns a |preview.Status| table.
|
||||
|
||||
*preview.Status*
|
||||
Status fields:~
|
||||
|
||||
`compiling` boolean Whether compilation is active.
|
||||
`watching` boolean Whether watch mode is active.
|
||||
`provider` string? Name of the active provider.
|
||||
`output_file` string? Path to the output file.
|
||||
|
||||
render.get_config() *render.get_config()*
|
||||
Returns the resolved |render.Config|.
|
||||
preview.get_config() *preview.get_config()*
|
||||
Returns the resolved |preview.Config|.
|
||||
|
||||
==============================================================================
|
||||
EVENTS *render.nvim-events*
|
||||
EVENTS *preview.nvim-events*
|
||||
|
||||
render.nvim fires User autocmds with structured data:
|
||||
preview.nvim fires User autocmds with structured data:
|
||||
|
||||
`RenderCompileStarted` Compilation began.
|
||||
`PreviewCompileStarted` Compilation began.
|
||||
data: `{ bufnr, provider }`
|
||||
|
||||
`RenderCompileSuccess` Compilation succeeded (exit code 0).
|
||||
`PreviewCompileSuccess` Compilation succeeded (exit code 0).
|
||||
data: `{ bufnr, provider, output }`
|
||||
|
||||
`RenderCompileFailed` Compilation failed (non-zero exit).
|
||||
`PreviewCompileFailed` Compilation failed (non-zero exit).
|
||||
data: `{ bufnr, provider, code, stderr }`
|
||||
|
||||
`PreviewWatchStarted` Watch mode enabled for a buffer.
|
||||
data: `{ bufnr, provider }`
|
||||
|
||||
`PreviewWatchStopped` Watch mode disabled for a buffer.
|
||||
data: `{ bufnr }`
|
||||
|
||||
Example:~
|
||||
>lua
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'RenderCompileSuccess',
|
||||
pattern = 'PreviewCompileSuccess',
|
||||
callback = function(args)
|
||||
local data = args.data
|
||||
vim.notify('Compiled ' .. data.output .. ' with ' .. data.provider)
|
||||
|
|
@ -186,13 +226,13 @@ Example:~
|
|||
<
|
||||
|
||||
==============================================================================
|
||||
HEALTH *render.nvim-health*
|
||||
HEALTH *preview.nvim-health*
|
||||
|
||||
Run `:checkhealth render` to verify:
|
||||
Run `:checkhealth preview` to verify:
|
||||
|
||||
- Neovim version >= 0.10.0
|
||||
- Neovim version >= 0.11.0
|
||||
- Each configured provider's binary is executable
|
||||
- Filetype-to-provider mappings are valid
|
||||
- Each configured provider's filetype mapping is valid
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
Loading…
Add table
Add a link
Reference in a new issue