fix typst pin
This commit is contained in:
parent
cebf16e11d
commit
6ce682a3fc
3 changed files with 20 additions and 7 deletions
3
init.lua
3
init.lua
|
@ -172,9 +172,6 @@ end, {
|
||||||
desc = 'Enable autoformat',
|
desc = 'Enable autoformat',
|
||||||
bang = true,
|
bang = true,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_user_command('TypstPinMain', function()
|
|
||||||
vim.lsp.buf.execute_command { command = 'tinymist.pinMain', arguments = { vim.api.nvim_buf_get_name(0) } }
|
|
||||||
end, { nargs = 0 })
|
|
||||||
|
|
||||||
-- autocommands
|
-- autocommands
|
||||||
-- ===
|
-- ===
|
||||||
|
|
|
@ -98,9 +98,6 @@ vim.api.nvim_create_autocmd('FileType', {
|
||||||
'typst',
|
'typst',
|
||||||
},
|
},
|
||||||
callback = function()
|
callback = function()
|
||||||
-- pin the main file
|
print "Don't forget to pin the main typst file for multifile support: <leader>tp"
|
||||||
vim.lsp.buf.execute_command { command = 'tinymist.pinMain', arguments = { vim.api.nvim_buf_get_name(0) } }
|
|
||||||
-- -- unpin the main file
|
|
||||||
-- vim.lsp.buf.execute_command { command = 'tinymist.pinMain', arguments = { nil } }
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -146,6 +146,23 @@ local servers = {
|
||||||
exportPdf = 'never',
|
exportPdf = 'never',
|
||||||
semanticTokens = 'disable',
|
semanticTokens = 'disable',
|
||||||
},
|
},
|
||||||
|
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]oggle [P]in (pin this file as main file)', 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]oggle [U]npin (unpin this file as main file)', noremap = true })
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
html = {},
|
html = {},
|
||||||
ts_ls = {},
|
ts_ls = {},
|
||||||
|
@ -208,6 +225,8 @@ vim.list_extend(ensure_installed, {
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
|
ensure_installed = nil,
|
||||||
|
automatic_installation = true,
|
||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue