It should be possible to remap shift+esc to ~, why not just do that?
This is actually the first thing I tried, but I quickly realized that it's not sufficient, even just for vim, because it doesn't work while editing commands (e.g., ":e ~/path/to/file.cpp" is basically untypeable because you have to go out of esc lock mode, type tilde, then go back into esc lock).
And besides that, I also need tilde and backtick outside of vim, so I'd need to do this remapping at the OS level, and I'm not sure that xmodmap can do that. (Maybe theferenc knows?)
A init script in VIM. You can remap caps lock to Esc in VIM and to windows key in the desktop. Do you try that solution?
I still need the caps/windows remapping even inside vim. And since I used xmodmap to do the mapping, as far as vim is concerned the caps lock key
is the Windows key, and I don't think vim can map the Windows key at all (this is a bizarre oversight given vim's emphasis on customization).