I use the vim-rails plugin to edit .erb files. In VIM in the insert mode, I could use a shortcut CTRL
–s
+ =
to insert <%= %> block, as shown [here][2] . But in NeoVim this keymapping CTRL
–s
is used by default by vim.lsp.buf.signature_help()
function
[![enter image description here][3]][3]
The NeoVim LSP [documentation][4] says that this default mapping can be disabled by:
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
vim.bo[ev.buf].formatexpr = nil
vim.bo[ev.buf].omnifunc = nil
vim.keymap.del(**'i', '<C-s>',** { buffer = ev.buf })
end,
})
But when it is added to my NeoVim config I got the following error:
Error detected while processing function <lambda>23[1]..<SNR>243_GetCapabilitiesResult[3]..<SNR>243_LspRequest[1]..LspAttach Autocommands for "*":
Error executing lua callback: vim/keymap.lua:0: E31: No such mapping
[![enter image description here][5]][5]
How to disable this keymapping Ctrl-s
for vim.lsp.buf.signature_help()
and keep it working for the rails-vim plugin?
[2]: /questions/4275209/how-do-i-insert-erb-tags-with-vim#:~:text=vim%20plugins)%3A,insert%20block
[3]: https://i.sstatic.net/z1saizo5.png
[4]: https://neovim.io/doc/user/lsp.html#i_CTRL-S:~:text=CTRL%2DS%20is,buf%20%7D)%0A%20%20end%2C%0A%7D)
[5]: https://i.sstatic.net/8NOlXYTK.png