What command do I have to enter to be able to leave editmode by pressing CapsLock in Vim?
In Linux, use the xmodmap utility
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
In Windows, you can use AutoHotkeys, or change your registry settings.
See this tip from Vim wiki for detailed instructions for Windows and also the linked tip for Linux.
In Ubuntu 9.04 using Gnome, this is most easily accomplished via the GUI. Go to System -> Preferences -> Keyboard, switch to the "Layouts" tab and click the "Layout Options" button. You'll find several "Caps Lock key behaviors" there to choose from. You can make CapsLock and additional Escape and you can swap both, e.g.
Unfortunately, it's not as simple as just entering a command, but it is a well-investigated topic. I'd go with the AutoHotkey method, if I were you.