How do I remap the 'Edit Mode' / 'Object Mode' key (tab) to a new key in Blender 2.8? I would like to make it so that '5' toggles between edit mode and object mode instead of pressing 'Tab'. I thought I could do this via Preferences->Keymap, but when I change the shortcut to '5' in the keymap it only goes one way (for instance edit to object) but it does not toggle back and forth. What am I missing? Do I need to create a custom operator just for this?
Go into Preferences > Keymap and in search type "mode"

Go down to Object Non-modal

Turn off Mode by clicking the tick

Then go to Set Object Mode

Click on tab and then press your chosen override key - 5

Make sure edit mode is selected in mode and toggle is ticked)