I feel a bit silly for asking this, but I have not been able to figure out a solution.
I would like to insert-mode bind some key combination to some predefined string.
Eg. when I hit <C-m> in insert mode, I would like |> to be injected (the Elixir pipe operator, it is a pain to type it manually with my keyboard layout).
Turns out the issue was caused by <C-m> being occupied. The backslash was not required, in fact, it cause an error with my init.lua implementation:
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
map('i', '<C-e>', '|>') # This works fine without '\'