There are many ways to rebind caps lock to be escape on press and control when used in combination with another key. Karbiner elements on macos and xcape on Linux come to mind immediately. But some keyboard firmwares are programmable enough to do it themselves too.
However. What I found best as a vim user was to use ^[ as escape. It has the added bonus of actually being faster to process by vim too.