Anki 2 is a really amazing piece of software and I'd regard it as almost perfect. One of the major missing features is imho the ability to change the default keyboard shortcuts. If you want to change them or add new ones, you have to edit the source. Fortunately this process isn't too complicated because the whole application is written in Python. The disadvantage is, that you need to make the changes after each update of Anki again though, but if you memorize or write down the changes, it's not that annoying.

The change I always apply to all my Anki installations is the ability to control the reviewer via the arrow keys. So that'll serve as an example in this post.
The interface files are located in the sub-folder "aqt" of Anki's install-directory. What I'll do now is to open the file "". This file contains the code, that is run, when you review/study your words. To change the keys, you have to edit the keyhandler "_keyHandler". This method is run everytime you push a key on your keyboard. If you have this information, you should actually already be able to adjust the keys to your liking. The only thing, you could easily overlook is the usage of "evt.key()" vs. "key". While "evt.key()" directly compares the key events (click here for a list of all possible key events), the variable "key" contains the pressed character.

I hope, this info is useful to you and to complete this post, here's my keyhandler in the reviewer file, where it is possible to use the arrow keys to answer a card and the "arrow down"-key is used to show the next card when the answer is shown.

    def _keyHandler(self, evt):
        key = unicode(evt.text())
        if key == "e":
        elif (key == " " or evt.key() in (Qt.Key_Return, Qt.Key_Enter, Qt.Key_Down)):
            if self.state == "question":
            elif self.state == "answer":
        elif key == "r" or evt.key() == Qt.Key_F5:
        elif key == "*":
        elif key == "-":
        elif key == "!":
        elif key == "V":
        elif key == "o":
        elif key in ("1", "2", "3", "4"):
        elif evt.key() == Qt.Key_Left:
        elif evt.key() == Qt.Key_Down:
        elif evt.key() == Qt.Key_Right:
        elif evt.key() == Qt.Key_Up:
        elif key == "v":
        elif evt.key() == Qt.Key_Delete:

6 Responses to “How to set custom keyboard shortcuts in Anki 2”

  1. markdaniel
    April 7th, 2013 at 01:51

    The link with the key events doesn’t seem to work anymore. does anyone know the event for “cloze deletion”?

  2. Regan
    May 26th, 2013 at 22:08

    How do I get to this code on a Mac? I searched for but nothing came up.

  3. Moritz
    August 20th, 2014 at 12:44

    As far as I know the application is compressed into an archive on Mac OS and needs to be extracted first.

  4. Brad
    November 14th, 2014 at 17:10

    Did not find any subfolder labeled “aqt” in the anki install directory.

    anki 2.0 – windows 7

  5. Adamaero
    November 19th, 2014 at 00:59

    Why not just use the number pad? The only shortcut I use is ctrl+shift C for cloze deletion anyways.

  6. Robin
    June 10th, 2015 at 01:38

    I don’t know how old this is (you should give some date information) but why don’t you create an add-on for this. Then you don’t have to worry about updates.
    In fact, some guy/girl made one to use j,k,l,; as the answer shortcuts.
    So you could just download that one and insert your code.

Leave a Comment

I respect your privacy
I don't run any trackers on this site.

Your questionable browsing-history should remain between you and the NSA ;-)