@@ -3,41 +3,6 @@ vim.b.slime_cell_delimiter = '```'
33local config = require (' quarto.config' ).config
44local 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-
256if 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- })
438end
0 commit comments