Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Notepad++ lets the user specify whether the end of lines (EOL) format for a file should be entirely in Windows, Unix, or Mac formats. Notepad++ also remembers the EOL format type encountered in the last used file and uses that EOL format if a new file is created.

This part is great.

The problem is that Notepad++ seems to have some pesky default keyboard shortcuts built-in that can create MIXED format files, creating havoc with this otherwise quite reasonable situation.

Specifically:

- Ctrl+M inserts a Mac style EOL character (i.e. 0x0D only) *on just that line*,
- Ctrl+J puts a UNIX style EOL character (i.e. (0x0A only) *on just that line*,

The hazard is that rapid typing and using the keyboard heavily with other shortcut commands could inadvertantly mean typing one of these above, each time turning at least one line in the file into another EOL format.

So my Question: How can I turn OFF these apparently built-in keyboard shortcuts.

Please Note: I've already scanned through Settings > Shortcut Mapper and could not find Ctrl+M or Ctrl+J listed for EOL conversion.

Thanks,

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

They are built in, but not in notepad++. Try it with plain notepad, or any other app, it will still work. They are common control ascii codes (that's where ctrl on that key comes from). Ctrl M will be decoded as 0A by keyboard controller/driver (similarly for other Ctrl combinations). More info here: http://en.wikipedia.org/wiki/Control_characters

share|improve this answer
1  
Well, that was a completely unexpected (but enlightening) explanation! (+1) Making it explicit: Control+[KEY] is implemented as subtracting 64d (decimal) or 0x40 from the ASCII value of the capital letter [KEY]. So since ascii(M) = 77d, ctrl+M = 13d = 0x0D, and since ascii(J) = 74d, ctrl+J = 10d = 0x0A... –  Assad Ebrahim Sep 28 '12 at 17:59
    
Hmmm... so how can this be protected against? –  Assad Ebrahim Sep 28 '12 at 18:06
    
@ake You probably could re-map the key combination in Windows (as the process in reality is more complex). I can't suggest particular product or procedure as I have not used them, but searching 'windows remap keyboard' brings many. –  wmz Sep 28 '12 at 18:16
    
Imposing such a global setting change on a system seems a bit too drastic. I think this would be best handled by a "usability feature" within Notepad++ to protect the integrity of source code files from ending up with mixed EOL formats. What do you think of not allowing different EOL formats for different lines? This could be implemented by trapping Ctrl+M and Ctrl+J and, if the file level EOL format is not set to either Mac or Unix respectively, then Notepad++ would suppress the characters (possibly issuing a notice the first time). Worth a bug / feature request to NPP? –  Assad Ebrahim Sep 29 '12 at 20:16
1  
@Ake I personally hate if a tool 'knows better' and does not allow me to do something, so I would rather opt for a message on open/save warning about inconsistent eol and offering option to normalize them. That's only me, though. As for requesting new feature - it's your call, but I can't see why not. –  wmz Sep 30 '12 at 10:14
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.