Firstly: RSI is no joke - if you're experiencing pain, there's a non-zero chance it'll develop into a serious medical condition. (At MIT's Media Lab, someone's RSI got so bad he couldn't type at all and had to invent an interface using vocal phonemes to encode common OS actions/lexical keywords to control his OS (OS X) / editor (emacs) / language of choice (python)).
If you feel even the slightest bit of pain, that's your body signalling to you 'hey buddy, don't do this'. I was suffering from emacs pinky to the point where my hands were aching hours after leaving my desk. On weekends, my tennis racket grip was significantly weaker and form poorer. Mapping Ctrl to caps, right shift to Esc, and buying a $30 MS Ergonomic keyboard solved my issues. My friends who have had worse issues spent the $300 on a Kinesis (which I had up until then considered to be snake oil) but it seems to have solved their issues entirely (and for $300 it's definitely a cheap investment compared to the opportunity cost of the time invested in physical therapy).
If you're on Linux, you can at the os-level make modal changes. I made the right-alt key move into a different mode, so I effectively get an entirely separate key-mapping when that key is depressed. (E.g., hjkl for me is OS-wide, and sdfg lets me move the cursor. nb. Were I to make this decision again, I'd use Caps as my primary modifier, [ as my secondary, effectively giving me four full keyboard maps. Probably overkill but if I were using something like SolidWorks or Illustrator where having both keyboard and mouse access available often, I'd be experimenting with a setup like that -- keeping my right hand always on the mouse, and left for keyboard shortcuts -- biasing all of the shortcut keys to the left-hand region of the keyboard.)
ErgoDox implements a similar system but on the micro-controller level so you don't even have to putz with modifiers and it's cross OS. I don't have one but I would have bought one if I used a desktop more often, simply due to the trackball-feature (effectively letting one use a mouse without leaving the home-row -- a 'must-have' for me).
Echoing the parent, take it very seriously. One thing that helped me was an verticle mouse (Evoluent C in my case). There's on one thing that will solve you're problems, just bit a pieces that will contribute to long term management.
One other thing is WorkRave which reminds me to take breaks. This is helpful for my hands, but has been frustrating for getting into the groove of programming.
The vertical mouse thing being "ergonomic" is nonsense. There are studies that have shown this. From memory it was generally worse for you to use a vertical mouse in terms of productivity and comfort.
The only thing vertical mice reduce is wrist movement.
Perhaps you might appreciate a different perspective. Broadly speaking, ergonomic devices are meant to combat repetitive strain injuries. I think of ergo devices as useful if they give you more variation. They might not be better positions in themselves, but switching between palms down and palms sideways when moving from the keyboard to mouse gives you variation that helps to combat RSI. At the very least, I couldn't put my palm down without pain for a while, so a sideways mouse is better at least from that vantage point.
Great post and an important disclaimer... take RSI seriously. I went the Kinesis route and switched to Dvorak (after taking a week off from typing) and I've never had a problem since (I ditched the Kinesis after a couple months and went back to my laptops keyboard).
RSI made Richard Stallman stop coding. It just got too painful for him and he eventually refocused his efforts on outreach. The Internet would not be what it is today without RSI.
If you feel even the slightest bit of pain, that's your body signalling to you 'hey buddy, don't do this'. I was suffering from emacs pinky to the point where my hands were aching hours after leaving my desk. On weekends, my tennis racket grip was significantly weaker and form poorer. Mapping Ctrl to caps, right shift to Esc, and buying a $30 MS Ergonomic keyboard solved my issues. My friends who have had worse issues spent the $300 on a Kinesis (which I had up until then considered to be snake oil) but it seems to have solved their issues entirely (and for $300 it's definitely a cheap investment compared to the opportunity cost of the time invested in physical therapy).
If you're on Linux, you can at the os-level make modal changes. I made the right-alt key move into a different mode, so I effectively get an entirely separate key-mapping when that key is depressed. (E.g., hjkl for me is OS-wide, and sdfg lets me move the cursor. nb. Were I to make this decision again, I'd use Caps as my primary modifier, [ as my secondary, effectively giving me four full keyboard maps. Probably overkill but if I were using something like SolidWorks or Illustrator where having both keyboard and mouse access available often, I'd be experimenting with a setup like that -- keeping my right hand always on the mouse, and left for keyboard shortcuts -- biasing all of the shortcut keys to the left-hand region of the keyboard.)
ErgoDox implements a similar system but on the micro-controller level so you don't even have to putz with modifiers and it's cross OS. I don't have one but I would have bought one if I used a desktop more often, simply due to the trackball-feature (effectively letting one use a mouse without leaving the home-row -- a 'must-have' for me).