OBS: Work In Progress
(Neo)vim plugin for Typst.
I am applying the 80/20 rule in this project since I prefer to have something now rather than waiting for everything later.
Editing typst-palette in Vim with the gruvbox colorscheme
Existing
:make.g:typst_conceal.g:typst_conceal_math.g:typst_conceal_emoji.g:typst_embedded_languages.Possible features
Do you miss anything from other packages, e.g. vimtex, create an issue
and I'll probably add it! Also feel free to make a PR!
require('packer').startup(function(use)
use {'kaarmu/typst.vim', ft = {'typst'}}
end)
:so % or restart neovim to reload config:PackerSyncreturn {
'kaarmu/typst.vim',
ft = 'typst',
lazy=false,
}
call plug#begin('~/.vim/plugged')
Plug 'kaarmu/typst.vim'
call plug#end()
:PlugInstallg:typst_syntax_highlight:
Enable syntax highlighting.
Default: 1g:typst_cmd:
Specifies the location of the Typst executable.
Default: 'typst'g:typst_pdf_viewer:
Specifies pdf viewer that typst watch --open will use.
Default: ''g:typst_output_to_tmp:
Redirect compiled PDFs to /tmp/typst_out/ followed by the file's path relative to $HOME.
Default: 0g:typst_conceal:
Enable concealment.
Default: 0g:typst_conceal_math:
Enable concealment for math symbols in math mode (i.e. replaces symbols
with their actual unicode character). OBS: this can affect performance,
see issue #64.
Default: g:typst_concealg:typst_conceal_emoji:
Enable concealing emojis, e.g. #emoji.alien becomes 👽.
Default: g:typst_concealg:typst_auto_close_toc:
Specifies whether TOC will be automatically closed after using it.
Default: 0g:typst_auto_open_quickfix:
Specifies whether the quickfix list should automatically open when there are errors from typst.
Default: 1g:typst_embedded_languages:
A list of languages that will be highlighted in code blocks. Typst is always highlighted.
If language name is different from the syntax file name, you can use renaming, e.g. 'rs -> rust'
(spaces around the arrow are mandatory).
Default: []g:typst_folding:
Enable folding for typst heading
Default: 0g:typst_foldnested:
Enable nested foldings
Default: 1:TypstWatch:
Watches your document and recompiles on change; also opens the document with your default pdf viewer.typst#synstack(kwargs):
Detects the inner most syntax group under the cursor by default.
Arguments. Accepts a single argument kwargs of dictionary type that can include the following keys (with defaults).
pos: getcurpos()[1:3].
only_inner: v:true.
Note. Does not work with treesitter enabled, see #117.typst#in_markup(...):
Returns true if syntax under the cursor is in "markup" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_code(...):
Returns true if syntax under the cursor is in "code" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_math(...):
Returns true if syntax under the cursor is in "math" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_comment(...):
Returns true if syntax under the cursor is a comment.
Arguments. Passes all arguments to typst#synstack.If you are using neovim you can install typst-lsp.
There exist a server configuration in nvim-lspconfig so it should be easy to set it up. The
config currently requires that you're working in a git repo. Once the neovim+LSP recognizes
the file the LSP will compile your document while you write (almost like a wysiwyg!). By default
it will compile on save but you can set it to compile-on-write as well.
Vim Script
99.4%
OBS: Work In Progress
(Neo)vim plugin for Typst.
I am applying the 80/20 rule in this project since I prefer to have something now rather than waiting for everything later.
Editing typst-palette in Vim with the gruvbox colorscheme
Existing
:make.g:typst_conceal.g:typst_conceal_math.g:typst_conceal_emoji.g:typst_embedded_languages.Possible features
Do you miss anything from other packages, e.g. vimtex, create an issue
and I'll probably add it! Also feel free to make a PR!
require('packer').startup(function(use)
use {'kaarmu/typst.vim', ft = {'typst'}}
end)
:so % or restart neovim to reload config:PackerSyncreturn {
'kaarmu/typst.vim',
ft = 'typst',
lazy=false,
}
call plug#begin('~/.vim/plugged')
Plug 'kaarmu/typst.vim'
call plug#end()
:PlugInstallg:typst_syntax_highlight:
Enable syntax highlighting.
Default: 1g:typst_cmd:
Specifies the location of the Typst executable.
Default: 'typst'g:typst_pdf_viewer:
Specifies pdf viewer that typst watch --open will use.
Default: ''g:typst_output_to_tmp:
Redirect compiled PDFs to /tmp/typst_out/ followed by the file's path relative to $HOME.
Default: 0g:typst_conceal:
Enable concealment.
Default: 0g:typst_conceal_math:
Enable concealment for math symbols in math mode (i.e. replaces symbols
with their actual unicode character). OBS: this can affect performance,
see issue #64.
Default: g:typst_concealg:typst_conceal_emoji:
Enable concealing emojis, e.g. #emoji.alien becomes 👽.
Default: g:typst_concealg:typst_auto_close_toc:
Specifies whether TOC will be automatically closed after using it.
Default: 0g:typst_auto_open_quickfix:
Specifies whether the quickfix list should automatically open when there are errors from typst.
Default: 1g:typst_embedded_languages:
A list of languages that will be highlighted in code blocks. Typst is always highlighted.
If language name is different from the syntax file name, you can use renaming, e.g. 'rs -> rust'
(spaces around the arrow are mandatory).
Default: []g:typst_folding:
Enable folding for typst heading
Default: 0g:typst_foldnested:
Enable nested foldings
Default: 1:TypstWatch:
Watches your document and recompiles on change; also opens the document with your default pdf viewer.typst#synstack(kwargs):
Detects the inner most syntax group under the cursor by default.
Arguments. Accepts a single argument kwargs of dictionary type that can include the following keys (with defaults).
pos: getcurpos()[1:3].
only_inner: v:true.
Note. Does not work with treesitter enabled, see #117.typst#in_markup(...):
Returns true if syntax under the cursor is in "markup" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_code(...):
Returns true if syntax under the cursor is in "code" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_math(...):
Returns true if syntax under the cursor is in "math" mode.
Arguments. Passes all arguments to typst#synstack.typst#in_comment(...):
Returns true if syntax under the cursor is a comment.
Arguments. Passes all arguments to typst#synstack.If you are using neovim you can install typst-lsp.
There exist a server configuration in nvim-lspconfig so it should be easy to set it up. The
config currently requires that you're working in a git repo. Once the neovim+LSP recognizes
the file the LSP will compile your document while you write (almost like a wysiwyg!). By default
it will compile on save but you can set it to compile-on-write as well.
Vim Script
99.4%