1
0
Fork 0

typst: initial setup

This commit is contained in:
Felipe 2023-11-10 02:04:44 -03:00
parent b6dcd77355
commit f07683b3c0
Signed by: pitbuster
SSH key fingerprint: SHA256:HDYu2Pm4/TmSX8GBwV49UvFWr1Ljg8XlHxKeCpjJpOk
5 changed files with 38 additions and 0 deletions

9
.gitmodules vendored
View file

@ -137,3 +137,12 @@
[submodule "pack/general/opt/ferris.nvim"] [submodule "pack/general/opt/ferris.nvim"]
path = pack/general/opt/ferris.nvim path = pack/general/opt/ferris.nvim
url = https://github.com/vxpm/ferris.nvim url = https://github.com/vxpm/ferris.nvim
[submodule "pack/general/start/typst.vim"]
path = pack/general/start/typst.vim
url = https://github.com/kaarmu/typst.vim
[submodule "pack/general/opt/typst-preview.nvim"]
path = pack/general/opt/typst-preview.nvim
url = https://github.com/niuiic/typst-preview.nvim
[submodule "pack/general/opt/core.nvim"]
path = pack/general/opt/core.nvim
url = https://github.com/niuiic/core.nvim

View file

@ -280,6 +280,7 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
"tex", "tex",
"toml", "toml",
"typescript", "typescript",
"typst",
}, },
callback = function() callback = function()
if vim.g.lsp_loaded == true then if vim.g.lsp_loaded == true then
@ -353,6 +354,7 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
texlab = {}, texlab = {},
tflint = {}, tflint = {},
tsserver = {}, tsserver = {},
typst_lsp = {},
} }
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
@ -685,3 +687,27 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
vim.keymap.set("n", "<leader>od", require("ferris.methods.open_documentation")) vim.keymap.set("n", "<leader>od", require("ferris.methods.open_documentation"))
end, end,
}) })
---- typst-preview
vim.g.typst_loaded = false
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "typst" },
callback = function()
if vim.g.typst_loaded then
return
end
vim.g.typst_loaded = true
vim.cmd("packadd core.nvim")
vim.cmd("packadd typst-preview.nvim")
local typst_preview = require("typst-preview")
typst_preview.setup({
preview = function(output_file)
require("core").job.spawn("xdg-open", {
output_file,
}, {}, function() end, function() end, function() end)
end,
})
typst_preview.preview()
end,
})

@ -0,0 +1 @@
Subproject commit e6aeba879abb3026db26eca863858e3801c87e94

@ -0,0 +1 @@
Subproject commit 0b47d30ce56d9cdc1183c2a202d766e96b6116f3

@ -0,0 +1 @@
Subproject commit 2fddf2beeec265e0a41dd24ac668d825f8f3657a