# using showHint for multiple lists

**URL:** https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681
**Category:** Uncategorized
**Created:** [March 29, 2018, 8:42pm UTC](https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681 "2018-03-29T20:42:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yxl01](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@yxl01](https://discuss.codemirror.net/u/yxl01)
#### Post date: [March 29, 2018, 8:42pm UTC](https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681/1 "2018-03-29T20:42:53Z")

</div>

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?

Thanks.

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [March 29, 2018, 8:55pm UTC](https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681/2 "2018-03-29T20:55:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![yxl01](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@yxl01](https://discuss.codemirror.net/u/yxl01)
#### Post date: [March 29, 2018, 9:57pm UTC](https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681/3 "2018-03-29T21:57:06Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [March 30, 2018, 5:27pm UTC](https://discuss.codemirror.net/t/using-showhint-for-multiple-lists/1681/4 "2018-03-30T17:27:11Z")

</div>

See [the documentation](http://codemirror.net/doc/manual.html#addon_show-hint), specifically the `hint` option.
