Whats up with the Tab key?
In programming modes (including Java, JavaScript, C, C++, PHP, Python, HTML, and XML), the Tab key is mapped by default to the command tab. The default behavior of this command is to re-indent the current line according to j’s idea of correct indentation. If you want to get rid of this behavior, you can create a custom key map for the mode in question that maps the Tab key to insertTab (see Key Mappings). You might also want to map some other key to indentLineOrRegion, which provides the re-indentation functionality assigned by default to the Tab key.