load packages only if installed

This commit is contained in:
Daniel Winkler 2026-05-21 20:04:45 +10:00
commit d23c7f6f51
4 changed files with 92 additions and 82 deletions

View file

@ -390,23 +390,25 @@ end)
-- zk
now_if_args(function()
require("zk").setup({
picker = "minipick",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
if nix.get_cat("markdown", false) then
require("zk").setup({
picker = "minipick",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})
},
})
end
end)

View file

@ -71,22 +71,24 @@ end)
now(function()
vim.treesitter.language.register("markdown", { "quarto", "rmd" })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "quarto" },
callback = function()
require("otter").activate()
end,
})
if nix.get_cat({"r", "markdown"}, false) then
vim.api.nvim_create_autocmd("FileType", {
pattern = { "quarto" },
callback = function()
require("otter").activate()
end,
})
require("otter").setup({
lsp = {
diagnostic_update_events = { "BufWritePost", "InsertLeave" },
},
buffers = {
set_filetype = true,
write_to_disk = true,
},
})
require("otter").setup({
lsp = {
diagnostic_update_events = { "BufWritePost", "InsertLeave" },
},
buffers = {
set_filetype = true,
write_to_disk = true,
},
})
end
end)
later(function()