Tinymist vs typst.vim vs typst-preview.nvim?

After nvarner/typst-lsp declared to be deprecated, what is the proper way to write typst in neovim?

I notice kaarmu/typst.vim, tinymist in nvim-lspconfig, and chomosuke/typst-preview.nvim.
All three projects have recent commits, and typst-preview.nvim says it is the neovim plugin for tinymist. Are they aiming at different goals?

Should I

  • use typst.vim,
  • or use tinymist through nvim-lspconfig,
  • or use tinymist through typst-preview.nvim,
  • or download tinymist then add some files to ~/.config/nvim/,
  • or append them all to require("lazy").setup({…}) + require('lspconfig').….setup{} in my init.lua? :face_with_spiral_eyes:

Any explanation or solution is welcomed. Thanks in advance.

Besides, I have read Tinymist Typst vs Typst LSP, but I am still confused…

Notes: I only use neovim for simple quick edits, so basic syntax highlighting and export-on-save are enough. Instant preview, cross-jump, hover tips, etc. are helpful, but not necessary to me.

1 Like

Tinymist bundles several features, including a Typst LSP and preview functionality.

  • nvim-lspconfig will connect to the LSP, and should enable features such as syntax highlighting. I’m not sure about
  • chomosuke/typst-preview.nvim uses the preview functionality only. Currently, it spawns a separate tinymist process and cannot connect to an already-running LSP (in contrast to the VSCode extensions, which uses the same tinymist process for both).

that is, both provide distinct and independent functionality. I don’t know about kaarmu/typst.vim.

1 Like

I use kaarmu/typst.vim. But that’s is only because I still use vim and not nvim.

I am no expert on vim, but from what I can see it only provides syntax highlighting. nothing else.

Edit: it actually provides some more features. But I don’t use or notice them.

1 Like

Thank you all! Putting together your answers gives a whole picture.

I will try to use tinymist through both nvim-lspconfig and typst-preview.nvim.


require("lazy").setup({
  "williamboman/mason.nvim",
  "williamboman/mason-lspconfig.nvim",
  "neovim/nvim-lspconfig",
  {
    "chomosuke/typst-preview.nvim",
    ft = "typst",
    version = "1.*",
    build = function() require "typst-preview".update() end,
  },
})
require("mason").setup()
require("mason-lspconfig").setup()

-- Setup language servers
-- (after MasonInstall)
local lspconfig = require("lspconfig")
lspconfig.typos_lsp.setup{}
lspconfig.tinymist.setup{
  single_file_support = true,
  settings = {
    exportPdf = "onSave",
  },
}

typst-preview.nvim uses tinymist in standalone mode, which means it runs preview server in “compatible mode”. Since preview is merged in the language server, they could actually spawn a preview server thread by calling some LSP commands instead of spawning a process to use less system resource, but we should negotiate a stable interface of the related lsp commands before doing so.

2 Likes

It looks like that tinymist is only a LSP, and typst.vim is a plugin.

For example,