Steps:
- Run Linux (and X windows)
- Plug in USB footpedal named something like 'RDing FootSwitch1F1.'
- Disable the footpedal as an input into X.
- Run this program as root.
- When you press the pedal down
<esc>a
will be typed. - When you release it,
<esc>
will be typed.
Concretely:
# Install it
pip3 install vim-clutchify
# Get input id of switch.
xinput | grep FootSwitch
# Disable the switch sending keys to X directly.
xinput disable ${ID_FROM_PREVIOUS_STEP}
# Launch it!
sudo vim-clutchify
# Open vim
vim
# Profit!
Inspired by this project by Aleksandr Levchuk.