Skip to content

qwjyh/tinymist-clientfeatures.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tinymist-clientfeatures.nvim

Extra client features for tinymist language server.

Features

  • Preview
  • Compile status
    • Handle compile status and word count notification

Installation

With lazy.nvim,

{
    "qwjyh/tinymist-clientfeatures.nvim",
    filetype = "typst",
    dependencies = {
        "nvim-telescope/telescope.nvim",
    },
}

Usage

Preview

: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

Outline of the document is available when preview is launched. This can be obtained with:

require("tinymist-clientfeatures.preview").instances.outline

This 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" }
)

Compile status

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").buffer

You 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.

Config

TODO

About

Advanced features mainly for tinymist preview.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages