0

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

romainl
  • 186,200
  • 21
  • 280
  • 313
chenzhongpu
  • 6,193
  • 8
  • 41
  • 79

1 Answers1

1

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.

hobbs
  • 223,387
  • 19
  • 210
  • 288
  • It turns out it is caused by the second reason, and now it works in Linux. But I have another issue: in MacOS, `M` key is Option, while `` is also mapped to a special character `‘` in Mac. Any idea how to solve it? – chenzhongpu Apr 11 '23 at 08:43
  • I have the same problem. On Mac, it insert `‘`. Let me know if you solve it! – SegFault Apr 12 '23 at 14:21
  • @chenzhongpu that's an OS-level problem, almost for sure. MacOS is re-mapping that key before your terminal or vim can ever see it. I don't use macs so I'm not qualified to answer that. – hobbs Apr 15 '23 at 02:30