From 1665721f7ba16671f519f3cd87382bc28258af04 Mon Sep 17 00:00:00 2001 From: Jannik Buhr <17450586+jmbuhr@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:55:25 +0200 Subject: [PATCH] feat!: remove the need for custom otter.nvim keybindings (#135) * wip * adding keybindings is no longer necessary --- ftplugin/quarto.lua | 35 ----------------------------------- lua/quarto/config.lua | 9 --------- 2 files changed, 44 deletions(-) diff --git a/ftplugin/quarto.lua b/ftplugin/quarto.lua index 018e0ee..9241a81 100644 --- a/ftplugin/quarto.lua +++ b/ftplugin/quarto.lua @@ -3,41 +3,6 @@ vim.b.slime_cell_delimiter = '```' local config = require('quarto.config').config local quarto = require 'quarto' -local function set_keymaps() - if not config.keymap then - return - end - local b = vim.api.nvim_get_current_buf() - local function set(lhs, rhs) - if lhs then - vim.api.nvim_buf_set_keymap(b, 'n', lhs, rhs, { silent = true, noremap = true }) - end - end - set(config.keymap.definition, ":lua require'otter'.ask_definition()") - set(config.keymap.type_definition, ":lua require'otter'.ask_type_definition()") - set(config.keymap.hover, ":lua require'otter'.ask_hover()") - set(config.keymap.rename, ":lua require'otter'.ask_rename()") - set(config.keymap.references, ":lua require'otter'.ask_references()") - set(config.keymap.document_symbols, ":lua require'otter'.ask_document_symbols()") - set(config.keymap.format, ":lua require'otter'.ask_format()") -end - 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, - }) end diff --git a/lua/quarto/config.lua b/lua/quarto/config.lua index 29a12ed..ece984c 100644 --- a/lua/quarto/config.lua +++ b/lua/quarto/config.lua @@ -22,15 +22,6 @@ M.defaultConfig = { -- Takes precedence over `default_method` never_run = { 'yaml' }, -- filetypes which are never sent to a code runner }, - keymap = { - hover = 'K', - definition = 'gd', - type_definition = 'gD', - rename = 'lR', - format = 'lf', - references = 'gr', - document_symbols = 'gS', - }, } -- use defaultConfig if not setup