3

According to the documentation on `:h lsp-quickstart :

Some keymaps are created unconditionally when Nvim starts:

grn is mapped in Normal mode to vim.lsp.buf.rename()

gra is mapped in Normal and Visual mode to vim.lsp.buf.code_action()

grr is mapped in Normal mode to vim.lsp.buf.references()

CTRL-S is mapped in Insert mode to vim.lsp.buf.signature_help()

But none of those are working for me, I can invoke the operations with for example :lua vim.lsp.buf.rename() but there is no grn mapping.

I'm using NVIM v0.10.0, surely those mappings should be there right?

I can create the mappings myself with

vim.keymap.set('n', 'grn', vim.lsp.buf.rename)
vim.keymap.set('n', 'gra', vim.lsp.buf.code_action)
vim.keymap.set('n', 'grr', vim.lsp.buf.references)
vim.keymap.set('i', '<C-s>', vim.lsp.buf.signature_help)

but those should be already there

1
  • Personally not a fan of these mappings. I now have to delete all three grn, gra, grr manually so that good old gr for references (which is used by nearly everyone) starts working again... Commented Jul 25 at 0:33

1 Answer 1

3

These default mappings were added after release of v0.10.0, in PR #28650: add LSP default mappings (again), so it has only made it into nightly releases of Neovim so far.

If you're not ready to jump into a nightly build, you can look at the code of that PR to reproduce the mappings same as they'll make it upstream in your local setup until it makes it into a release.

2
  • 1
    I must remember to check the in app documentation :h lsp-quickstart instead of relying on the online documentation. Commented Jul 24 at 19:41
  • That's exactly how I found about this quickly, I tried to look it up and didn't see the snipped you pasted :-)
    – filbranden
    Commented Jul 24 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.