Creating a User Defined Language in Notepad++


I just posted about adding PowerShell syntax support to Notepad++ by adding a User Defined Language definition. It's pretty simple; here's a quick overview of how I did it. For a more in depth overview of the User Defined Language system, check out the Notepad++ docs.

Like most of these editors, Notepad++ saves language definitions in an XML file, but Notepad++ includes front end (the User Defined Language editor), which makes it a lot easier to set it up. You can bring up the User Defined Language editor from the menu (View -> User Define Dialog...):

Notepad++ User Defined Language

There are four tabs to fill out - Folder (as in code folding), Keyword, Comment, and Operators. You may have to dig through the docs for the language you're adding to find these, but in a lot of cases it's not to hard to get a list of supported keywords. In the case of PowerShell, you can get a list of all commands by running the "get-command". Make sure to set the file extension and language name. There's no save button, which is a little confusing, but the changes take effect as you make them and the changes are saved to the userDefineLang.xml file when you close Notepad++. If you're just making the changes for your own use, that's it - you're done. But be a sport and share them, would you? It's not too hard - you just have to distribute your changes to the userDefineLang.xml file.

Installing a user defined language file that someone else has written is pretty simple as long as you haven't installed any previously - you just rename the file to userDefineLang.xml and drop it in your %APPDATA%\Notepad++\ directory as pictured below. If you've added other user defined languages, you need to merge the two XML files together. That's pretty bad on the user experience side, but if you're the kind of person who needs two user defined languages, you're a total geek who loves merging XML files anyways.

32 Comments

  • As someone said before, the userDefineLang.xml file can be located in %appdata% *or* in notepad++'s directory.

    In my case, it didn't pick the userDefineLang.xml located in %appdata%, but the one in notepad++'s directory.

  • Does anyone know if anyone has made a 4DOS implementation of Notepad++ language version? I would be keen to use that. At the moment I use batch language, but it is not that great since a variable in 4DOS would be %var, not %var% as in batch, but apart from that, all goodz.

  • I've installed the Autohotkey language file (available on the Notepad++ website) but for some reason it doesn't highlight Keywords if they are followed by a comma, is there any way around this? Thanks in advance.

  • Does anyone know of a NPP language definition for MediaWiki syntax?

  • can i add more file extensions for an existing languages?
    i want php styling for ctp extension.
    ive added ctp here in langs.model.xml like this:
    name="php" ext="php php3 phtml ctp"
    but nothing happened.

  • Re: can i add more file extensions for an existing languages?

    Yes. Add the extensions in langs.xml, not langs.model.xml

  • How can I get syntax folding on asp files ?

  • I want to migrate my langage customisation from Editeur (development ended) to Notepad++
    But something is stupid for me:
    as user defined language are not in separated files, share and upgrade of user defined language will not be easy.
    Is there a tool to merge different xml files ?

  • I want to know how can I get syntax highlight for ASP files not only with VBscript code but with Jscript either. Thanks

  • I am trying to create a user defined language for abaqus input files(.inp).

    i need to define code folding such a way that, all lines that occur between the lines that start with a '*' are to be folded.

  • Have created my own User Defined Language. Great System. Is there any way to combine it into the install of NotePad++ so I can avoid telling users to install NotePad++ and then my User Defined Language. ie Have one install only.

  • Is there a way to set a Bounding Delimiter Close Symbol as New-Line?

    I am trying to realize that starting at a specific symbol - all following text within a specific line will be a certain color.

    greez, dc

  • I'm trying to find a language file. Anyone here ever made a file for the Parallax PBASIC 2.5 language?

  • I'm trying to give a coloring to a particular log file where the whole line sould be colored in different ways depending on a code it starts with.

    Do you think there could be a way to use regular expression to define which color give to such "keywords".
    Is there any way to define more than 4 different groups?

  • Hi, I would like to edit specman elite (e language) with notepad++. is there a ready custom plugin for this language?

  • I have created a user defined language file for Rules Language (couldn't find it in files already contributed by others). Where and how can I share it?

  • just a observation.... strange forum... new question(s) on every post... noone even tries to answer... :O)

  • thanks a lot,
    the only place that told me how realy do it well.

  • I have one doubt.. please clarify,
    in user defined language dailog,
    for folderopen and folderclose , can we have multi part keyword????

    like below:

    BEGIN A
    BEGIN B

    END B
    END A

    Please some one help to achieve this one.. Thanks alot..

  • Hey there! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up
    losing many months of hard work due to no back up.
    Do you have any methods to protect against hackers?

  • Hello friends, pleasant post and fastidious arguments commented at this place, I am truly enjoying by these.

  • I was curious if you ever thought of changing the page layout of your blog?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures.
    Maybe you could space it out better?

  • how do you change an archive file into a music file or back to its original with its compressed properties?

  • My programmer is trying to convince me to move to .
    net from PHP. I have always disliked the idea because of the expenses.
    But he's tryiong none the less. I've been using Movable-type on numerous
    websites for about a year and am worried about switching to
    another platform. I have heard fantastic things about blogengine.
    net. Is there a way I can import all my wordpress content into it?
    Any kind of help would be really appreciated!

  • What's up mates, how is everything, and what you would like to say regarding this article, in my view its truly awesome designed for me.

  • You actually make it appear so easy together with your presentation however
    I find this topic to be really one thing which I think I would by no means understand.

    It kind of feels too complex and extremely huge for me.
    I'm taking a look forward in your next post, I'll attempt to
    get the cling of it!

  • If some one needs expert view concerning blogging and site-building then i advise him/her to visit this blog,
    Keep up the fastidious job.

  • Having read this I believed it was very informative. I appreciate you taking the time and energy to put this short article
    together. I once again find myself personally spending a lot of time both reading and posting comments.
    But so what, it was still worth it!

  • For a lot of of the men and women in people times it intended emigration to Hokkaido.
    It was not extensive right after the person was gone which
    i left the parking lot and continued my tramp south along Route
    113. Now everyone has read that in advance of a lot of occasions at their Martial Arts university, but until finally you may have essentially finished it inside
    a authentic fight, you don't really imagine it.

  • talnie ściągniętymi lejcami. Furmanka przechylił się blogspot.
    com niedaleko akompaniamencie
    przekleństw woźnicy, poturlały się z niego dorodne głowy
    mamony.
    Skuliła się w błocie, chwytając świst bata. Wprawdzie w tym momencie zamysle był koński kufer,

    wiedziała wydarzenie, że a na nią nadejdzie kolejka.
    Apiać nie mogła dawać dyla, giczoła była
    zdrętwiała, jako bezwładna.
    Ucichło mlaskanie kopyt na rozmięk�.

  • Up to now this is certainly the only real working dragon town
    hack
    thanks for that, I hope it'll get the job done for many years.

  • My developer is trying to persuade me to move to .
    net from PHP. I have always disliked the idea because of the expenses.
    But he's tryiong none the less. I've been using Movable-type on a variety
    of websites for about a year and am concerned about switching to
    another platform. I have heard fantastic things about blogengine.
    net. Is there a way I can import all my wordpress posts into
    it? Any kind of help would be really appreciated!

Comments have been disabled for this content.