src/os_unix.c:RealWaitForChar()
This function is over 400 lines and contains over 40 #ifdef
s. Its job? To wait for keyboard input. Several factors caused this code to be so insane.
- Vim tries to be compatible with every OS, including dead ones such as BeOS, VMS, and Amiga.
- Features that drastically change behavior are enabled/disabled with preprocessor flags.
- Cross-platform libraries like libuv didn’t exist when Vim was created.