using showHint for multiple lists

I would like to use showHint with multiple lists associated with different CTR-key. That is, CTRL-A to bring up list A and CTRL-B to bring up list B. Is this possible?

Looking at the “synonym” showHint example, I thought maybe I can detect what keys were pressed and switch the “comp” to point to different completion list. But I am unable to figure out a way to detect the keys pressed.

Does anyone know a way to accomplish this?


Yes. You can pass showHint a completion function to use, and bind different keys to different invocations of showHint.

Thanks, Marijn. How would I pass the “completion” function to showHint()? I tried cm.showHint(function () {…}) but the function didn’t get called. Could you give an example?

See the documentation, specifically the hint option.