Using otter for markdown files and not just .qmd
Closed this issue · 3 comments
Is it possible to configure otter
for use in markdown files. I have registered it with cmp
can only get it tow work in .qmd files.
Yes that's the idea of having otter.nvim as a separate plugin. You can create an autocommand that calls otter.activate when a md file is opened or call it manually. Here is how it is done for quarto: https://github.com/quarto-dev/quarto-nvim/blob/0f2b3f6f0e1a856378f0fd6551d45d16920089fd/lua/quarto/init.lua#L163
Is there a way to use otter without installing quarto? Quarto is currently too coupled for my use-case. Are there plans to break out the LSP from the actual quarto app so it could be used in the regular way with lspconfig.[quarto].setup{}
Like I said, that's why otter.nvim exists. All quarto-nvim doe is create an autocommand to do otter.activate when a quarto file is opend and pass some configuration to it. You can pretty much just copy and paste this part and do the same for markdown. In fact this function from otter.nvim does exactly that for testing!
M.dev_setup = function()
api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.md" },
callback = function()
M.activate({ 'r', 'python', 'lua' }, true)
vim.api.nvim_buf_set_keymap(0, 'n', 'gd', ":lua require'otter'.ask_definition()<cr>", { silent = true })
vim.api.nvim_buf_set_keymap(0, 'n', 'K', ":lua require'otter'.ask_hover()<cr>", { silent = true })
end,
})
end
Not sure what you mean by LSP. There currently is no quarto lsp. You might want to read about what otter.nvim does in the readme.