The key <Equal>
simply does not exist.
The characters will be taken literally and the mappings would work fine if you pressed <Shift-EQUAL> but that's not what anybody wants.
Instead of using a non-existing key code, use the actual key you want to map: =
All codes for special (usually non-printing) keys are found in :help key-codes
.
There's no <Equal>
for regular =
.
Why would there? =
prints just fine.
By the way, to keep in line with other Normal mode commands, I'd suggest ==
to work on the current line and =<motion>
to work on <motion>
:
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '==', 'gqq', opts)
vim.keymap.set({'n', 'v'}, '=', 'gq', opts)
As mentioned in the comments, this will shadow the default =
functionality.
You should probably enable these mappings only for certain filetypes.
Usually, gq
and related commands are useful to format natural language texts while =
is better for formalized languages (read: code).
Personally, I use =
a lot (more often than gq
) and would not want to miss it.