Creating a User Defined Language in Notepad++ - Jon Galloway

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.

Published Saturday, November 25, 2006 3:38 PM by Jon Galloway
Filed under: ,

Comments

# re: Creating a User Defined Language in Notepad++

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.

Wednesday, August 13, 2008 5:42 AM by Norz

# re: Creating a User Defined Language in Notepad++

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.

Wednesday, October 15, 2008 10:57 PM by Nathan

# re: Creating a User Defined Language in Notepad++

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.

Friday, November 14, 2008 5:46 AM by RogueWolf

# re: Creating a User Defined Language in Notepad++

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

Monday, November 24, 2008 7:40 AM by John Doe

# re: Creating a User Defined Language in Notepad++

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.

Saturday, January 10, 2009 5:19 AM by ram

# re: Creating a User Defined Language in Notepad++

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

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

Monday, January 12, 2009 9:04 PM by jsbennett

# re: Creating a User Defined Language in Notepad++

How can I get syntax folding on asp files ?

Sunday, January 25, 2009 2:59 PM by Dee

# re: Creating a User Defined Language in Notepad++

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 ?

Tuesday, February 10, 2009 8:17 AM by Gegematic

# re: Creating a User Defined Language in Notepad++

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

Monday, March 30, 2009 12:34 AM by Diego

# re: Creating a User Defined Language in Notepad++

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.

Friday, April 17, 2009 3:52 PM by bvindh

# re: Creating a User Defined Language in Notepad++

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.

Sunday, June 28, 2009 10:03 PM by Jeff B

# re: Creating a User Defined Language in Notepad++

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

Monday, August 31, 2009 5:58 AM by dc

# re: Creating a User Defined Language in Notepad++

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

Tuesday, February 2, 2010 3:37 PM by Kaos

# re: Creating a User Defined Language in Notepad++

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?

Friday, April 9, 2010 4:56 AM by Roberto Tirabassi

# re: Creating a User Defined Language in Notepad++

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

Thursday, October 14, 2010 7:52 AM by Tsafrir Waller

# re: Creating a User Defined Language in Notepad++

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?

Saturday, October 23, 2010 12:28 AM by Ninad

# re: Creating a User Defined Language in Notepad++

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

Thursday, November 18, 2010 2:51 AM by the Observer

# re: Creating a User Defined Language in Notepad++

thanks a lot,

the only place that told me how realy do it well.

Sunday, December 5, 2010 8:50 AM by Nuno

# re: Creating a User Defined Language in Notepad++

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..

Monday, April 9, 2012 1:15 PM by ranganath

# re: Creating a User Defined Language in Notepad++

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?

Monday, August 20, 2012 10:16 PM by Mcmichael

# re: Creating a User Defined Language in Notepad++

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

Friday, March 15, 2013 5:44 AM by Moffett

# re: Creating a User Defined Language in Notepad++

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?

Friday, March 15, 2013 7:38 AM by Raley

# re: Creating a User Defined Language in Notepad++

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

Monday, April 1, 2013 10:10 PM by olyggr@yahoo.co.uk

# re: Creating a User Defined Language in Notepad++

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!

Tuesday, April 30, 2013 9:45 PM by Dubose

# re: Creating a User Defined Language in Notepad++

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.

Wednesday, May 1, 2013 8:47 AM by Alford

# re: Creating a User Defined Language in Notepad++

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!

Thursday, May 9, 2013 9:35 PM by Durbin

# re: Creating a User Defined Language in Notepad++

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.

Saturday, May 11, 2013 5:04 AM by Callender

# re: Creating a User Defined Language in Notepad++

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!

Saturday, May 11, 2013 7:09 PM by Carbajal

# re: Creating a User Defined Language in Notepad++

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.

Monday, May 13, 2013 11:11 AM by Whyte

# re: Creating a User Defined Language in Notepad++

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�.

Wednesday, May 15, 2013 2:46 AM by Henson

# re: Creating a User Defined Language in Notepad++

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.

Saturday, May 18, 2013 11:59 PM by Lozano

# re: Creating a User Defined Language in Notepad++

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!

Wednesday, May 22, 2013 7:36 PM by Waugh