Search code examples
neovimkonsole

How to disable `Alt sends Escape` in Konsole?


I am using copilot.lua in which <M-[> and <M-]> are mapped to prev and next. In Linux, M is Alt.

However, when I type <M-]> in insert mode, it will be mapped to Esc (in normal mode), and then ]. So it seems that Alt sends Escape in konsole. How can I disable such mapping?

I also checked the keyboard settings in the current profile, but none of them is related with it:

enter image description here


Solution

  • You can't change it in Konsole — alt is supposed to send escape, and vim understands escape to mean alt/meta. Either vim is somehow being configured improperly for your terminal, or the mapping that you think is installed isn't.

    To debug the first one, go into insert mode and then press Ctrl+V Alt+]. If <M-]> is inserted then everything is configured correctly. If you leave insert mode instead, then perhaps your $TERM is set incorrectly, there is a problem with your terminfo database, or you're overriding some crucial vim setting.

    To debug the second one, run :imap and verify that a <M-]> mapping actually appears there. If not, then start digging into your copilot.lua config.