Notepad++: How to automatically set Language as Xml when load files

XmlText EditorNotepad++

Xml Problem Overview


Whenever I edit a .config file in Notepad++ (which is an XML file) I want the syntax highlighting to automatically color it like XML. How do I configure Notepad++ to do this so that I don't have to manually select it every time I open a .config file?

Thanks.

Xml Solutions


Solution 1 - Xml

You can do this by using the Style Configurator (Settings Menu):

This image shows the php language, but it works for any language you want to map

enter image description here

Solution 2 - Xml

From the Settings menu, choose Style Configurator.... Choose the XML Language from the list, and enter "config" in the User ext field.

Solution 3 - Xml

I don't think you can set a default style for all files (there may be some config file trickery that does allow it though) but as you specifically mention .config files, you can open the langs.xml or langs.model.xml file in your Notepad++ installation directory, find the xml section, and add config to the value of the ext attribute:

<Language name="xml" ext="xml xsml xsl xsd kml wsdl config" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;">
</Language>

Or, use the Style Configuarator as noted by @AdamHawkes (+1), instead of messing around in the XML config files themselves!

Solution 4 - Xml

To set a 'global' default language:

  1. Launch Notepad++
  2. Click Settings > Preferences
  3. Click on the New Document/Default Directory tab
  4. Change the Default Language to HTML
  5. Click the Close button

Solution 5 - Xml

For anyone that's seeing this in 2017, the location has changed: enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondevlordView Question on Stackoverflow
Solution 1 - XmlErikestView Answer on Stackoverflow
Solution 2 - XmlAdam HawkesView Answer on Stackoverflow
Solution 3 - XmlJames AllardiceView Answer on Stackoverflow
Solution 4 - Xmluser1220478View Answer on Stackoverflow
Solution 5 - Xmldylanh724View Answer on Stackoverflow