Supported Programming Languages

Language Detection Priority

When opening an existing file, Notepad++ has an algorithm for trying to decide which language a given file is, with the following priorities:

  1. A language defined at the command line using -l is applied.
  2. If the file is in the active session file (the automatic session.xml or a manually-controlled session), it will use the language stored in that session.
  3. If the file extension is a “known extension” (whether it’s from the Style Configurator‘s default extension list [in langs.xml or langs.model.xml] or user-defined extension list [from stylers.xml or themes\<ThemeName>.xml] for a built-in language, or the User Defined Language‘s extension settings [from userDefineLang.xml or userDefineLangs\<UDLName>.xml]), Notepad++ will use that language.
  4. If the filename matches one of a few specific names, Notepad++ knows what language they should be:
filename language
makefile Makefile
GNUMakefile Makefile
CMakeLists.txt CMake
SConstruct Python
SConscript Python
wscript Python
Rakefile Ruby
Vagrantfile Ruby
crontab Shell Script
5. If the first line in the file gives a known hint as to the file type, it will use that. This includes “prolog lines” starting with <?xml or <?php or <html or <!DOCTPE html or <?, or linux-style “shebang” lines like #!/usr/bin/bash which are looking for sh or python or perl or php or ruby or node to define the correct language.
6. It will use the default language only if none of the other rules have matched.

As Notepad++ goes through that list in order, it will stop as soon as it finds a matching language for the file. And after Notepad++ has made its detection, you can override what it chose by using the Language menu (and when a session gets saved, the language will remember whatever language is currently active for that file for next time, as described in priority 2).

If you do a Save As on a file, it will use that same sequence for deciding the language, based on the new name and file contents.

Newly-created documents will assume the default language until they are saved.