Function keys and Enter key on built-in keyboard of 13" rMBP mysteriously remapped. How to fix or reset to default? The built-in keyboard of my Macbook Pro started acting weird. I only started to have this problem around last week. I thought upgrading to 
Yosemite 10.10.3 would remove the issue but it still exists.


Pressing the Enter/Return key OR Right-Shift triggers the
"Shift-Enter" combo.
Pressing the Escape key is now increasing the brightness of my
display.
Pressing the F1 key decreases the brightness AND decreasing my
volume.
Pressing the F2 key increases the brightness AND triggers the Escape
key.
Pressing the F5 key decreases the keyboard light AND inputs "-" and
vice versa.
Pressing the F6 key increases the keyboard light AND inputs "/" and
vice versa.
Pressing the F7 key inputs ";". 
Pressing the F8 key enters a new line or triggers the Enter key (?)
Pressing the F9 key inputs "\".
Pressing F11 key decreases my volume and brightness.


Using an external keyboard doesn't seem to have a problem. I tried doing a PRAM and SMC reset but to no avail. Tried also changing the keyboard preferences like restoring to the default settings, removing extra keyboard layouts I use for work and using the function keys as standard function keys. I tried installing Karabiner keymap tool hoping to disable some keys but it still triggers some of the weird behaviour the keys mysteriously adapted so I uninstalled it.

The problem did go away two days ago (I have no idea how. I was just doing work research and the keys started working normally) but unfortunately, after turning it back on today for another day of work, the problem came back.

Any ideas on what I can do to fix this? 
Is it most likely a hardware or a software problem?
First, boot into single user mode/verbose mode. If the problem persists, its hardware.

The hardware problem can be as simple as a loose connector between keyboard and logic board. I had experience with a malfunctioning trackpad on my no-retina MBP 13'. The cause was that the connector came loose and only some lines of signals were fed into the system. I don't see how the connector would come loose without external cause; I opened up/modded my MBP many many times. However, I can say that there is free space between the connector and the bottom chassis of the laptop, enough for it to become loose.

I know retina-ones are different from my MBP in config, so you should look up ifixit to see if that's the case for you. Plus, you might have warranty concerns etc that stop you from opening up the machine.