# Binding Command+k to open Insert Link prompt

**URL:** <https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354>\
**Category:** Show\
**Created:** [May 28, 2018, 3:49pm UTC](https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354 "2018-05-28T15:49:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericandrewlewis](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/ericandrewlewis/32/59_2.png) [@ericandrewlewis](https://discuss.prosemirror.net/u/ericandrewlewis)\
**Post date:** [May 28, 2018, 3:49pm UTC](https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354/1 "2018-05-28T15:49:08Z")

</div>

Command+k is a popular keybinding to insert a link, so I made a basic implementation of this with ProseMirror.

Here’s [the code](https://glitch.com/edit/#!/prosemirror-command-k-to-create-link) and [a demo](https://prosemirror-command-k-to-create-link.glitch.me/).

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [May 28, 2018, 4:12pm UTC](https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354/2 "2018-05-28T16:12:28Z")

</div>

You should return `true` from the function bound to the key—on many browsers, ctrl-k focuses the URL bar, and if the command doesn’t indicate that it handled the key, the default behavior will go through.

---

<div class="post-metadata">

**Author:** ![ericandrewlewis](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/ericandrewlewis/32/59_2.png) [@ericandrewlewis](https://discuss.prosemirror.net/u/ericandrewlewis)\
**Post date:** [May 28, 2018, 4:37pm UTC](https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354/3 "2018-05-28T16:37:14Z")

</div>

Thanks for reviewing! I updated the code to fix that bug.

---

<div class="post-metadata">

**Author:** ![ericandrewlewis](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/ericandrewlewis/32/59_2.png) [@ericandrewlewis](https://discuss.prosemirror.net/u/ericandrewlewis)\
**Post date:** [February 13, 2021, 2:23am UTC](https://discuss.prosemirror.net/t/binding-command-k-to-open-insert-link-prompt/1354/4 "2021-02-13T02:23:33Z")

</div>

I am impressed this mildly hacky solution works with ProseMirror 2 1/2 years later and doesn’t require any updates from the original. Great work with the stability here.
