Skip to content

Commit 1665721

Browse files
authored
feat!: remove the need for custom otter.nvim keybindings (#135)
* wip * adding keybindings is no longer necessary
1 parent ea55d21 commit 1665721

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

ftplugin/quarto.lua

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,6 @@ vim.b.slime_cell_delimiter = '```'
33
local config = require('quarto.config').config
44
local quarto = require 'quarto'
55

6-
local function set_keymaps()
7-
if not config.keymap then
8-
return
9-
end
10-
local b = vim.api.nvim_get_current_buf()
11-
local function set(lhs, rhs)
12-
if lhs then
13-
vim.api.nvim_buf_set_keymap(b, 'n', lhs, rhs, { silent = true, noremap = true })
14-
end
15-
end
16-
set(config.keymap.definition, ":lua require'otter'.ask_definition()<cr>")
17-
set(config.keymap.type_definition, ":lua require'otter'.ask_type_definition()<cr>")
18-
set(config.keymap.hover, ":lua require'otter'.ask_hover()<cr>")
19-
set(config.keymap.rename, ":lua require'otter'.ask_rename()<cr>")
20-
set(config.keymap.references, ":lua require'otter'.ask_references()<cr>")
21-
set(config.keymap.document_symbols, ":lua require'otter'.ask_document_symbols()<cr>")
22-
set(config.keymap.format, ":lua require'otter'.ask_format()<cr>")
23-
end
24-
256
if config.lspFeatures.enabled then
267
quarto.activate()
27-
set_keymaps()
28-
-- set the keymap again if a language server attaches
29-
-- directly to this buffer
30-
-- because it probably overwrites these in `LspAttach`
31-
-- TODO: make this more robust
32-
-- This currently only works if 'LspAttach' is used
33-
-- directly, e.g. in LazyVim
34-
-- It does no work if the `on_attach` callback
35-
-- is used in the lspconfig setup
36-
-- because this gets executed after the `LspAttach` autocommand
37-
-- <https://github.com/neovim/neovim/blob/d0d132fbd055834cbecb3d4e3a123a6ea8f099ec/runtime/lua/vim/lsp.lua#L1702-L1711>
38-
vim.api.nvim_create_autocmd('LspAttach', {
39-
buffer = vim.api.nvim_get_current_buf(),
40-
group = vim.api.nvim_create_augroup('QuartoKeymapSetup', {}),
41-
callback = set_keymaps,
42-
})
438
end

lua/quarto/config.lua

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ M.defaultConfig = {
2222
-- Takes precedence over `default_method`
2323
never_run = { 'yaml' }, -- filetypes which are never sent to a code runner
2424
},
25-
keymap = {
26-
hover = 'K',
27-
definition = 'gd',
28-
type_definition = 'gD',
29-
rename = '<leader>lR',
30-
format = '<leader>lf',
31-
references = 'gr',
32-
document_symbols = 'gS',
33-
},
3425
}
3526

3627
-- use defaultConfig if not setup

0 commit comments

Comments
 (0)