I looked up ways to bind keys to commands in minecraft, but came up empty. I would like to bind a key in a command block that gives the effect "levitation 255" so you would press a key and glide for a few seconds. I am not looking forward to getting mods for this.
There is no way to do this in Vanilla Minecraft, except by having the command in the clipboard and quickly pressing the command key, Ctrl+V and Enter. You can also select it from the command history using the up and down arrow keys.
Directly binding to commands is only possible with mods or with third party software (like keyboard automation programs that do what I suggested, but very fast, or something that inputs commands for you on a server).