2

I am recently migrating from vimscript to lua with Nvim. While converting the keymappings, I ran into a problem with the following keymap:

[ init.vim ]

tmap <leader>e <C-\><C-n>

[ init.lua ] ( error )

map('t','<leader>e','<C-\><C-n>')

Whenever I reload with above keymap, Nvim will throw the following error:

enter image description here

I'm assuming that "\" might be the problem. If so, how do I refactor the keymap properly for it to work? Any feedback will be greatly appreciated.

1 Answer 1

4

It is most likely as the \ is used to escape special characters in the string. Try putting

map('t','<leader>e','<C-\\><C-n>')

This way you are telling Lua that you want the backslash character and not some other special character.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.