Which one has more precedence: noremap or remap?

vim.keymap.set has two options that are inverse of each other: noremap and remap. but the document hasn’t stated which one has more precedence. Is this a recursive mapping:

vim.keymap.set("n", "<C-j>", ":cnext", {noremap = true, remap = true})

vim.keymap.set() ignores noremap. It overrides noremap based on the value of remap.

Do you mean that noremap is useless or that remap has more precedence?

noremap is useless when using vim.keymap.set() (where you should be using remap = true if you don’t want noremap, which is the default behavior when setting mappings with this function).

I find that very confusing.
I read the docs several times and I never find the information I need when mapping keys using the Lua API. Maybe what you mentions should be added explicitly

1 Like