custom keymap
MAKE CAPS LOCK ACT AS ESCAPE IN VT
Locate the keymap file you are currently using, ie:
/usr/share/vt/keymaps/us.kbd
Copy the file and rename it to whatever you like.
# cp /usr/share/vt/keymaps/us.kbd /usr/share/vt/keymaps/custom.kbd
Edit the new file and look for the line containing `clock':
058 clock clock clock clock clock clock clock clock O
Replace the first `clock' with 'esc'
058 esc clock clock clock clock clock clock clock O
Test the new configuration on the fly:
$ kbdcontrol -l custom.kbd
To load the new keymap on boot, edit /etc/rc.conf and add/change the keymap variable. This is the name of the keymap file without the *kbd suffix.
keymap="custom"
See kbdmap(5) for other key codes.
To still use CAPS LOCK with this configuration, you may toggle it with CTRL + CAPS LOCK.