As title. I want to simulate the App-switching feature of macOS cmd+tab. To do so I need to detect the release of some key to trigger my lua function. Any idea?

1 Answer 1


If you're using (Neo)vim inside a terminal: no, not really, because the terminal just sends the keypress, and that's it. So there is no way for any application to detect anything more. As far as I know there are no terminals that implement extensions to this.

You can see exactly what the terminal sends with <C-v>[keypress] inside Vim and most shells. For example <C-v>a or <C-v><F1>. This sends just an a or ^[OP (the code for F1, on my system anyway).

Some GUI wrappers at least have the technical capability to offer more possibilities for this, but AFAIK none do.

I don't know how Cmd+Tab in macOS behaves exactly; you may be able to do some cleverness to hack around things, but it probably won't be straightforward.

  • Thanks for the claraification :) And I just read a reply from reddit where they said key-holding cannot be detected too. Commented Nov 29, 2022 at 1:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.