Extra client features for tinymist language server.
- Preview
- Launch preview via LSP
- Outline previewer for telescope.nvim.
- Compile status
- Handle compile status and word count notification
With lazy.nvim,
{
"qwjyh/tinymist-clientfeatures.nvim",
filetype = "typst",
dependencies = {
"nvim-telescope/telescope.nvim",
},
}:TinymistStartPreview or :TinymistStartDefaultPreview starts preview lanching web browser.
The latter uses server side config of preview.browsing.args for preview and this can launch only one preview per tinymist process.
The former can have multiple previews and accepts following options:
slide: preview in slide mode
TODO: support more options (tinymist preview --help)
As you scroll the cursor on neovim, the preview also scrolls like synctex.
This feature can be disabled/enabled with :TinymistToggleScrollPreview.
And :TinymistStopPreview stops the preview.
Outline of the document is available when preview is launched. This can be obtained with:
require("tinymist-clientfeatures.preview").instances.outlineThis plugin offers telescope.nvim extension for outline picker.
This can be invoked with :Telescope tinymist-clientfeatures.
Selecting outline entry triggers source and preview scroll.
vim.keymap.set(
'n',
'<leader>fo',
require("telescope").extensions["tinymist-clientfeatures"].tinymist_outline,
{ desc = "show outline of tinymist preview" }
)Command :TinymistShowCompileStatus shows compile status (success or fail) and character countings like this:
{
pageCount = 23,
path = "example.typ",
status = "compileSuccess",
wordsCount = {
chars = 11215,
cjkChars = 2541,
spaces = 581,
words = 3487
}
}
This value can be obtained with
require("tinymist-clientfeatures.tinymist_status").bufferYou can show this status on status line. Below is an example with lualine.
{
require("tinymist-clientfeatures.tinymist_status").show_status,
cond = function()
return vim.bo.filetype == "typst"
end,
color = require("tinymist-clientfeatures.tinymist_status").show_status_color,
}Note that compile status works without starting preview.
TODO