Search code examples
notepad++syntax-highlightingline-endings

Syntax highlight line ending in Notepad++


I am using Notepad++ and I would like a gentle reminder (not enforcement) of which line-ending (LF, CR or CR-LF) is being used in a particular file or line. I have turned on View|Show Symbol|Show All Characters. So far so good.

Call them quibbles, but I find this annoying when used all day long. First - with typical syntax highlight settings, the special LF and CR characters are light text on a dark background, which is too strong for my eye. Second, I have to squint to tell the difference between the two. Together, the whole exercise is more annoying than helpful and I find myself toggling this feature.

Ideally, I would tone down both characters, and I would make them two different colors. If that is not possible then I would draw my own, less jarring versions of these special characters.

From my reading, I can define my own custom syntax but it looks like a lot of work, especially since I want this feature for multiple languages (PHP, JavaScript, HTML, Java, text...), I don't want to fix what ain't broke in the defaults, and I am not confident of success anyway.

Can I achieve something like this at all? Can I achieve something like this easily?


Solution

  • Notepad++ shows you what line endings are used in the file in the status bar located at the bottom of the window. The status bar is toggled in Settings->Preferences->General->Show status bar.

    CR\LF = Dos/Windows

    LF = UNIX

    CR = Macintosh

    I ran some quick tests and it seems that it classifies the file based on the first line break it encounters, but only when loading it. Changing the first line break doesn't seem to update the status, but it is reevaluated if you close and reopen or do a File->Reload from Disk.

    You can specify the default line ending for new files in Settings->Preferences->New Document/Default Directory->New Document->Format.