From d5748108b5f9e08c154a097bd7dd212f523368ea Mon Sep 17 00:00:00 2001 From: Jannik Buhr Date: Tue, 25 Jun 2024 16:36:40 +0200 Subject: [PATCH] wip --- ftplugin/quarto.lua | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ftplugin/quarto.lua b/ftplugin/quarto.lua index 018e0ee..fe5d148 100644 --- a/ftplugin/quarto.lua +++ b/ftplugin/quarto.lua @@ -22,22 +22,27 @@ local function set_keymaps() set(config.keymap.format, ":lua require'otter'.ask_format()") end +local otterconfig = require('otter.config').cfg + if config.lspFeatures.enabled then quarto.activate() - set_keymaps() - -- set the keymap again if a language server attaches - -- directly to this buffer - -- because it probably overwrites these in `LspAttach` - -- TODO: make this more robust - -- This currently only works if 'LspAttach' is used - -- directly, e.g. in LazyVim - -- It does no work if the `on_attach` callback - -- is used in the lspconfig setup - -- because this gets executed after the `LspAttach` autocommand - -- - vim.api.nvim_create_autocmd('LspAttach', { - buffer = vim.api.nvim_get_current_buf(), - group = vim.api.nvim_create_augroup('QuartoKeymapSetup', {}), - callback = set_keymaps, - }) + -- only manually set keyjaks if not already done by otter + if not otterconfig.lsp.hijack then + set_keymaps() + -- set the keymap again if a language server attaches + -- directly to this buffer + -- because it probably overwrites these in `LspAttach` + -- TODO: make this more robust + -- This currently only works if 'LspAttach' is used + -- directly, e.g. in LazyVim + -- It does no work if the `on_attach` callback + -- is used in the lspconfig setup + -- because this gets executed after the `LspAttach` autocommand + -- + vim.api.nvim_create_autocmd('LspAttach', { + buffer = vim.api.nvim_get_current_buf(), + group = vim.api.nvim_create_augroup('QuartoKeymapSetup', {}), + callback = set_keymaps, + }) + end end