Hi,
I have tried prepare keymap configuration in lua language. My goal is use <C-;> in insert or normal mode to execute some command. For example enter ; on the end of line. I have written very silple function and init file.
local M = {}
M.mapWrapper = function(mode, lhs, rhs)
vim.api.nvim_set_keymap(mode, lhs, rhs, {noremap = false})
end
return M
local map = require("key_wrapper").mapWrapper
map("n", "<C-;>", "A;<CR>")
When I trying enter <C-;> i received error E433 and E426.
I have use Windows 10 and PowerShell. The same situation is in NeoVim gui version
Those errors are related to not being able to find a tag file/tag and don’t have anything directly to do with what you’re trying to map; I’m not really sure how you’re getting that error here unless you have a mapping for looking up tags.
I suspect that your terminal emulator doesn’t actually send Ctrl+; and is actually just sending a semicolon on its own. You can check by entering either INSERT or COMMAND mode and typing Ctrl+V and then Ctrl+;. If you see just a semicolon, then your terminal isn’t sending Ctrl+;, so nvim never sees it. I’m personally using kitty and can confirm that it isn’t sent.
As an alternative, you could try mapping to Alt+; (<M-;>
). It works for me on kitty:
map("n", "<M-;>", "A;<CR>")
Hi,
thank you for your feedback. I have checked your tips. When I enter the Ctrl-;
I get a ] sign. Do you have any idea why that happening?
I’m not a Windows user, but I suspect it’s a problem with Powershell. Have you tried the “normal” Windows terminal?
I used CMD terminal and Nvim qt terminal. A have installed Vim and had the same issue. Propably it is OS issue.
I map <C-;> to line end.
when I trying enter <C-;> it escape from insert mode.
Env: windows 10 and windows terminal, same in cmd and powershell, except nvim-gui.
Do you know how solve it?