mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-07 21:15:03 +00:00

Some checks failed
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / build-vsc-assets (push) Has been cancelled
tinymist::ci / build-vscode (push) Has been cancelled
tinymist::ci / build-vscode-others (push) Has been cancelled
tinymist::ci / publish-vscode (push) Has been cancelled
tinymist::ci / build-binary (push) Has been cancelled
tinymist::ci / E2E Tests (darwin-arm64 on macos-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-22.04) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-2019) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-latest) (push) Has been cancelled
* fix: bad link * feat(neovim): init lsp * feat(neovim): add bootstrap script * build: add notice
89 lines
3 KiB
Lua
89 lines
3 KiB
Lua
-- https://github.com/neovim/neovim/blob/381806729db1016106b02d866c4f4f64f76a351f/src/nvim/highlight_group.c
|
|
local links = {
|
|
-- Unable to pick a suitable highlight group for the following:
|
|
-- ['@lsp.type.raw.typst'] = '@markup.link',
|
|
-- ['@lsp.type.punct.typst'] = '@punctuation',
|
|
-- ['@lsp.mod.math.typst'] = '@',
|
|
-- "*.strong.emph": [
|
|
-- "markup.bold.typst markup.italic.typst"
|
|
-- ],
|
|
|
|
['@lsp.mod.strong.typst'] = '@markup.strong',
|
|
['@lsp.mod.emph.typst'] = '@markup.italic',
|
|
|
|
['@lsp.type.bool.typst'] = '@boolean',
|
|
['@lsp.type.escape.typst'] = '@string.escape',
|
|
['@lsp.type.link.typst'] = '@markup.link',
|
|
['@lsp.typemod.delim.math.typst'] = '@punctuation',
|
|
['@lsp.typemod.operator.math.typst'] = '@operator',
|
|
['@lsp.type.heading.typst'] = '@markup.heading',
|
|
['@lsp.type.pol.typst'] = '@variable',
|
|
['@lsp.type.error.typst'] = 'DiagnosticError',
|
|
['@lsp.type.term.typst'] = '@markup.bold',
|
|
['@lsp.type.marker.typst'] = '@punctuation',
|
|
['@lsp.type.ref.typst'] = '@label',
|
|
['@lsp.type.label.typst'] = '@label',
|
|
}
|
|
|
|
for newgroup, oldgroup in pairs(links) do
|
|
vim.api.nvim_set_hl(0, newgroup, { link = oldgroup, default = true })
|
|
end
|
|
|
|
return {
|
|
-- requires tinymist
|
|
{
|
|
"williamboman/mason.nvim",
|
|
version = "^1.0.0",
|
|
opts = {
|
|
ensure_installed = {
|
|
"tinymist",
|
|
},
|
|
},
|
|
},
|
|
-- add tinymist to lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
"mason.nvim",
|
|
"williamboman/mason-lspconfig.nvim",
|
|
},
|
|
---@class PluginLspOpts
|
|
opts = {
|
|
---@type lspconfig.options
|
|
servers = {
|
|
tinymist = {
|
|
root_dir = function()
|
|
return vim.fn.getcwd()
|
|
end,
|
|
single_file_support = true, -- Fixes LSP attachment in non-Git directories
|
|
--- See [Tinymist Server Configuration](https://github.com/Myriad-Dreamin/tinymist/blob/main/editors/neovim/Configuration.md) for references.
|
|
settings = {
|
|
--- You could set the formatter mode to use lsp-enhanced formatters.
|
|
-- formatterMode = "typstyle",
|
|
|
|
--- If you would love to preview exported PDF files at the same time,
|
|
--- you could set this to `onType` and open the file with your favorite PDF viewer.
|
|
-- exportPdf = "onType",
|
|
},
|
|
on_attach = function(client, bufnr)
|
|
vim.keymap.set("n", "<leader>tp", function()
|
|
client:exec_cmd({
|
|
title = "pin",
|
|
command = "tinymist.pinMain",
|
|
arguments = { vim.api.nvim_buf_get_name(0) },
|
|
}, { bufnr = bufnr })
|
|
end, { desc = "[T]inymist [P]in", noremap = true })
|
|
|
|
vim.keymap.set("n", "<leader>tu", function()
|
|
client:exec_cmd({
|
|
title = "unpin",
|
|
command = "tinymist.pinMain",
|
|
arguments = { vim.v.null },
|
|
}, { bufnr = bufnr })
|
|
end, { desc = "[T]inymist [U]npin", noremap = true })
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|