### Install typst-preview.nvim with Packer.nvim Source: https://github.com/chomosuke/typst-preview.nvim/blob/master/README.md Configure Packer.nvim to install the plugin and automatically call the setup function. ```lua use { 'chomosuke/typst-preview.nvim', tag = 'v1.*', config = function() require 'typst-preview'.setup {} end, } ``` -------------------------------- ### vim-plug Setup for typst-preview.nvim Source: https://context7.com/chomosuke/typst-preview.nvim/llms.txt This example illustrates how to integrate typst-preview.nvim with vim-plug, specifying the plugin and tag, and then calling the setup function in your Neovim configuration. ```vim -- vim-plug -- Plug 'chomosuke/typst-preview.nvim', {'tag': 'v1.*'} -- Then in your init.vim/init.lua: require('typst-preview').setup {} ``` -------------------------------- ### Minimal lazy.nvim Setup for typst-preview.nvim Source: https://context7.com/chomosuke/typst-preview.nvim/llms.txt This configuration uses lazy.nvim for minimal setup, automatically loading the plugin to provide Typst previews for any .typ file. It implicitly calls the setup function with default options. ```lua -- lazy.nvim — minimal setup { 'chomosuke/typst-preview.nvim', lazy = false, -- load immediately so preview is available for any .typ file version = '1.*', opts = {}, -- calls setup({}) implicitly } ``` -------------------------------- ### setup Source: https://context7.com/chomosuke/typst-preview.nvim/llms.txt Initializes the plugin and performs a binary download/update check. This function should be called once during Neovim configuration. ```APIDOC ## setup(opts) ### Description Initializes the plugin, merges user options with defaults, and triggers a quiet binary download/update check. This function must be called once. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **opts** (table) - Optional. A table of configuration options. See the plugin's documentation for available keys such as `debug`, `open_cmd`, `port`, `host`, `invert_colors`, `follow_cursor`, `dependencies_bin`, `extra_args`, `get_root`, and `get_main_file`. ### Request Example ```lua require('typst-preview').setup({ debug = true, open_cmd = 'firefox %s', }) ``` ### Response None ``` -------------------------------- ### Install typst-preview.nvim with vim-plug Source: https://github.com/chomosuke/typst-preview.nvim/blob/master/README.md Add this line to your vimrc for installation using vim-plug. ```vim Plug 'chomosuke/typst-preview.nvim', {'tag': 'v1.*'} ``` -------------------------------- ### Setup typst-preview.nvim Configuration Source: https://github.com/chomosuke/typst-preview.nvim/blob/master/README.md Configure the typst-preview.nvim plugin with various options such as debug logging, custom commands, port binding, color inversion, and cursor following. This setup function requires the 'typst-preview' module. ```lua require 'typst-preview'.setup { -- Setting this true will enable logging debug information to -- `vim.fn.stdpath 'data' .. '/typst-preview/log.txt'` debug = false, -- Custom format string to open the output link provided with %s -- Example: open_cmd = 'firefox %s -P typst-preview --class typst-preview' open_cmd = nil, -- Custom port to open the preview server. Default is random. -- Example: port = 8000 port = 0, -- Custom host to bind the preview server to. -- Note that '0.0.0.0' is not supported and [won't be](https://github.com/Myriad-Dreamin/tinymist/issues/2105) -- Example: host = '192.168.0.10' host = '127.0.0.1', -- Setting this to 'always' will invert black and white in the preview -- Setting this to 'auto' will invert depending if the browser has enable -- dark mode -- Setting this to '{"rest": "