I created a keymapping in nvim to swap the left and right side of an C equality comparison insice parentheses. It works like a charm from the nvim command prompt.
:nnoremap <F3> ci(:let @r=substitute(@*, '\(.*\) == \(.*\)', '\2 == \1', '')<CR><C-r>r<ESC>
Now I wanted to put it into my lua configuration
vim.api.nvim_set_keymap("n", "<F3>", "ci(:let @r=substitute(@*, '\(.*\) == \(.*\)', '\2 == \1', '')<CR><C-r>r<ESC>", { noremap = true, silent = true })
and get an error
invalid escape sequence near '"ci(:let @r=substitute(@*, '
I tried several things but it was pure guessing. So what is the correct lua configuration code?
and as sidenote: how could I debug the error message to solve it myself?