feat(commands): add :Preview open subcommand (#6)
Problem: after closing a viewer, there was no way to re-open the last compiled output without recompiling. Solution: track the most recent output file per buffer in a `last_output` table that persists after compilation finishes. Add `compiler.open()`, `M.open()`, and wire it into the command dispatch.
This commit is contained in:
parent
0b16ff7178
commit
cfe101c6c4
5 changed files with 76 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
local M = {}
|
||||
|
||||
local subcommands = { 'compile', 'stop', 'clean', 'toggle', 'status' }
|
||||
local subcommands = { 'compile', 'stop', 'clean', 'toggle', 'open', 'status' }
|
||||
|
||||
---@param args string
|
||||
local function dispatch(args)
|
||||
|
|
@ -14,6 +14,8 @@ local function dispatch(args)
|
|||
require('preview').clean()
|
||||
elseif subcmd == 'toggle' then
|
||||
require('preview').toggle()
|
||||
elseif subcmd == 'open' then
|
||||
require('preview').open()
|
||||
elseif subcmd == 'status' then
|
||||
local s = require('preview').status()
|
||||
local parts = {}
|
||||
|
|
@ -47,7 +49,7 @@ function M.setup()
|
|||
complete = function(lead)
|
||||
return complete(lead)
|
||||
end,
|
||||
desc = 'Compile, stop, clean, toggle, or check status of document preview',
|
||||
desc = 'Compile, stop, clean, toggle, open, or check status of document preview',
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue