View Full Version : Notepad++ Avisynth Syntax Highlighting
smokeslikeapoet
18th August 2006, 21:42
I've been using Notepad++ for text file editing including Avisynth. Notepad++ is a great editor and GPL'ed for those of you that care.
http://sourceforge.net/projects/notepad-plus/
It doesn't support syntax highlighting for Avisynth so I took the time to create a user defined language for Avisynth with all known internal and external plugin keywords and thought I would share it.
It should highlight most AviSynth functions and syntax. If you have any suggestions for improvements let me know.
Download the file (once it's approved) and put it in your user application data directory. For english language Windows users it's usually:
c:\Documents and Settings\[User Name]\Application Data\Notepad++\
It's safe to overwrite the existing file as long has you don't have any other user defined languages.
* notepad plus plus for forum searchers
mod
18th August 2006, 22:24
Thanks! I'm a Notepad++ "addicted", I'm going to try it in the next days :)
smok3
18th August 2006, 23:17
tnx as well, will try at first avisynth session.
p.s. permission to mirror on my server?
smokeslikeapoet
19th August 2006, 00:05
@smok3, you can mirror it, but be sure and subscribe to this thread so you will be notified of updates. I'm sure there's some keywords from external plugins that I've left out.
dosdan
19th August 2006, 06:19
How do I get ".avi" & ".avsi" as files-of-type file-extension filters in the File | Open selection box? I tried using Settings | Preference | File Association | Customise and added .avi in the box next to Customise but could not get it to go acros to s the Registed Exts. column since the arrow was grayed out.
smokeslikeapoet
19th August 2006, 06:31
I don't know, I didn't have that problem. But the best way to register extensions I've found is to right click on the file. Go to "Open With" | Choose Program | select the program and make sure "Always use the selected program..." is checked.
http://img218.imageshack.us/img218/5414/notepadfileexttt3.th.jpg (http://img218.imageshack.us/my.php?image=notepadfileexttt3.jpg)
unskinnyboy
19th August 2006, 06:50
Not to hijack your thread or anything, but for those interested, VirtualDubMoD's Script Editor (CTRL+E) provides some excellent syntax highlighting and keyboard shortcuts and that's what I have been using lately. Especially when you are scripting your avs and want to see the goodness (or badness :-p) as you go, all it takes is an F5 (or F7) and et voilą!
..and I have tried 'em all - notepad.exe to AVSEdit.
Melanchthon
19th August 2006, 22:42
Not to hijack your thread or anything, but for those interested, VirtualDubMoD's Script Editor (CTRL+E) provides some excellent syntax highlighting and keyboard shortcuts and that's what I have been using lately.
I use that almost exclusively. Possibly the single most useful thing about it is that commented text becomes greyed-out.
http://img145.imageshack.us/img145/2323/vdmsekk1.th.gif (http://img145.imageshack.us/my.php?image=vdmsekk1.gif)
Not much use if you don't use VirtualDubMod though.
Are there any screenshots available of this? Also, when you say user-defined language, does that mean you can add any filter name you like? I tend to avoid putting things in the plugins folder (it's getting kind of full), so most of the functions I use don't show up unless VDM thinks they're a misspelling.
Highlighting of defined clips (clp1, clp2, clpmask, or whatever naming scheme you use) would be a neat feature as well, if it can't already do it.
smokeslikeapoet
19th August 2006, 23:36
With my plugin for notepad++ internal filters turn blue when called, external ones are brown, comments are small italicized green. The thing that I don't like is that everything in parentheses turns blue. Numbers should be read but if they are inside the parens they aren't recognized. From the screenshot you can tell I missed a external filter function, YV12InterlacedReduceBy2At60(0).
You can edit the user defined language yourself by clicking View | User Define Dialog | then select the Avisynth from the drop down menu.
http://img215.imageshack.us/img215/1842/notepadscreenshotpg8.th.jpg (http://img215.imageshack.us/my.php?image=notepadscreenshotpg8.jpg)
vcmohan
23rd August 2006, 03:08
Download the file (once it's approved) and put it in your user application data directory. For english language Windows users it's usually:
c:\Documents and Settings\[User Name]\Application Data\Notepad++\
It's safe to overwrite the existing file as long has you don't have any other user defined languages.
I have downloaded both Notepad++ and your userdefinelang.zip. On installation I could not activate your userdefinelang at all. In my Documents Settings folder thereis no Application data folder. So I created one and tried. It did not work. I then placed this file in Notepad++ folder under program files. It did not work. Then I tried copying your file in to the lang.xml file. It did not show up as an additional language. Then I tried creating a separate user defined 'mylang' file using the Notepad++ just to know where such a file is kept. I could not locate at all anywhere eventhough it is shown in the lower part of the languages dropdown list. So now I can not get rid of it. What should I do to activate your file?
My system is AMD XP 2000+ 512mb Ram, windows xp pro.
smokeslikeapoet
23rd August 2006, 04:40
Try uninstalling notepad++. Make sure the uninstallation deletes the "program files\notepad++" directory and the application data directory. Then reinstall notepad++, run the program at least once. The first time you run it it should create the "application data\notepad++" directory then you should be able to drop the userdefinelang.xml file in that directory. If it doesn't create the "application data\notepad++" the first time its run then you'll need to contact the notepad++ author or file a bug on the sourceforge website. Good luck.
Koti
23rd August 2006, 05:47
Thx :)
note - i just put the "userDefineLang.xml" into the same folder as Notepad ++ (C:\Program Files\Notepad ++) and it picked it up.
foxyshadis
23rd August 2006, 16:01
In my Documents Settings folder thereis no Application data folder.
Sure there is (well, in your profile folder, not the root D&S), but it's hidden, just like Local Settings. If you want in the easy way, just type %appdata% in the address bar, otherwise you need to unhide hidden files and rehide them once done. (If, like me, you prefer them hidden.)
krieger2005
23rd August 2006, 23:19
The Folder can also named different. For me, from Germany "Aplication data" folder is "Anwendungsdaten".
vcmohan
24th August 2006, 03:41
Thanks. I could meanwhile manage it. I found that in word 4 the external plugins are named. In several plugins of mine there are a number of functions, and calls are to these functions. So in place of plugin names these function names may be included. In my copy I have changed in respect of my plugins. There may be others too I am not sure. I can send a copy of this new file if desired.
Is it necessasary that they all be listed on one line? Is it possible to break the lines to ensure readability?
Alain2
9th September 2006, 18:21
Good idea to share this ^^ I already have my own syntax highlights that I am populating when required; if someones interested it's available here (http://homepages.nildram.co.uk/~cestial/userDefineLang.xml)
Keiyakusha
26th May 2009, 15:23
Sorry for bumping this tread... Does anyone still using Notepad++ for avisynth script editing? If so, maybe someone can update this userDefineLang. It is still very useful but since 2006 there is many new plugins, scripts etc. :thanks:
Chiba
26th May 2009, 17:26
HAN !
Thanks a lot *___* <3<3<3:thanks:
XadoX
25th September 2009, 08:16
:thanks:
varied
13th October 2009, 17:17
Thanks!
All works just great except when a file name contains non latin letters [in my case cyrillic *source("зяблик.avi")]. A workaround is quite easy, just to rename the file to something like "zjablik.avi".
But that should be done a lot, since all my files are named that way.
I guess, there is no way to change that...
Anyway, thanks again! :)
Edit:
I played a bit more and found that this had nothing to do with cyrillic characters. Highlighting is messed up if a filename contains parenthesis...
smok3
16th August 2011, 15:23
years later:
you may want to replace lines 9-13 with this:
<Keywords name="Delimiters">"00"00</Keywords>
<Keywords name="Folder+">Try Catch Function</Keywords>
<Keywords name="Folder-">}</Keywords>
<Keywords name="Operators">- ! $ % ( ) * , . / : ? ^ | + < = ></Keywords>
<Keywords name="Comment">1 2 0#</Keywords>
to get some colorfully separated numeros.
edit:
here is (my) latest version of the userDefineLang.xml: http://pastebin.com/tpUUd7ep
snap: http://imagebin.org/168107
(a lot of room for improvements)
Fyx
11th December 2011, 16:42
I made a ruby blue variant of smok3's latest xml if anyone is interested. The file needs to be renamed to work.
r3t3ch
5th March 2012, 02:18
Here is an updated highlight scheme for avisynth: http://paste2.org/p/1930937
I updated the filter lists with what I had listed from AvsP and changed the colors to mostly match the default AvsP font and color style. Both avs and avsi extensions are supported.
It is still very limited by being a user defined language instead of an internal lexer.
A Scintilla lexer that is probably much more functional was written about a month ago for notepad2-mod here:
https://code.google.com/p/notepad2-mod/source/browse/trunk/scintilla/lexers/LexAVS.cxx
Maybe someone capable of recompiling SciLexer.dll can implement it into Notepad++?
smok3
5th March 2012, 09:00
notepad mod looks interesting, what exactly is improved?
http://shrani.si/t/2a/EW/4uiEkP8U/clipboard01.jpg (http://shrani.si/f/2a/EW/4uiEkP8U/clipboard01.png)
r3t3ch
6th March 2012, 04:10
notepad mod looks interesting, what exactly is improved?
That mod is a fork of notepad2, which as far as I know has nothing to do with notepad++. I personally prefer notepad++ as an overall text editor so I am not interested in using notepad2-mod just to edit text of avs. It might be more to your liking though and an internal lexer is still far superior to a user defined language in notepad++.
Chikuzen
6th March 2012, 18:40
@r3t3ch
nice work :)
btw, after 2.5.8, avisynth can use /**/ to block comment like C.
I consider that it is better to also change this.
<Keywords name="Comment">1/* 2*/ 0#</Keywords>
r3t3ch
6th March 2012, 20:01
btw, after 2.5.8, avisynth can use /**/ to block comment like C.
I consider that it is better to also change this.
<Keywords name="Comment">1/* 2*/ 0#</Keywords>
I originally included this in the comment block section but the problem is that asterisk and forward-slash both need to be excluded from the activated operator list in order for the comment block to recognize them as a symbol.
Doing so would damage the formatting of certain functions, like so:
http://i.imgur.com/TnKc1l.png (http://i.imgur.com/TnKc1.png)
Considering how infrequently /* */ comment blocks are used opposed to # comment lines, I chose the lesser of two evils. This is among several other imperfections due to the limitations of a user defined language vs an internal lexer.
martin53
17th November 2013, 18:14
http://notepad-plus.sourceforge.net/commun/userDefinedLang/AVISynth_syntax.zip
Or the attachment, which includes v2.6 commands (as far as I identified them from the v2.6 change log) plus GRunT+GScript+RT_Stats. Ctrl+B (jump to matching bracket) works also for '{ ... }' in this definition :D.
It happened to become a bit candy coloured; change that to your needs if you're more the reputable type ;)
Multi line strings are configured to contain identifiers, operators etc. This means: If you find yourself writing multiline strings that are not script commands but contain script syntax, you're misguided. If you write multiline script strings, this setting is helpful.
Oh, installation guide: Open np++, in Menu 'Language' click 'Define your language', 'Import', and pick the XML. You may change the language name "AviSynth" inside the XML in advance to be able to switch between several syntax highlighters at the same time.
EDIT 23. 11.2013 updated syntax file with all AvsPmod functions and user scripts, and folding in multi line strings, more eye friendly colors
kypec
18th November 2013, 09:26
:thanks: for XML language highlighting package. I'm using mostly AvsPmod because of ability to preview scripts in real time but Notepad++ has been my favourite editor since few years now and sometimes it's faster to invoke this for quick/batch editing of AVS file(s)...
martin53
22nd November 2013, 08:09
I do both: typically I use a small .AVI file in AvsPmod for preview, which calls functions from larger function collections or plugin files.
These files (typically >1000 lines) can more comfortably be edited in Notepad++. Preview update then with F5 instead of Esc.
turbojet
30th November 2013, 23:13
Thanks for this, I found a few issues with mp_pipeline's (mpp) syntax:
1. (""" and """) are used to start/end mpp's syntax but all appear as light blue, like they are part of quotes.
2. ### and ### ### are parameter and splitter in mpp, they show as light green like comments.
martin53
1st December 2013, 16:03
Hmm, I spent hours to teach notepad++ the triple double-quotes.
For my part, I write many triple quoted script parts like e.g. ScriptClip or GScript. There I want syntax highlighting and folding.
But when I teach notepad++ double-qoutes to be string separators, triple double-quotes are automatically treated as three double-quotes and notepad++ gets confused about what follows.
I found no way to define triple double-quotes as an exception, so I abused the syntax: I defined double double-quotes as an own separator with higher priority than single double-quotes, which ends with a single double-quote, with a comma, a closing brace or end-of-line.
Since you probably know mp_pipeline's syntax far better than me, maybe you like to fiddle a bit with the settings to find a smarter solution. I'm sollr I dont think I'll be able to.
feos
28th August 2016, 09:42
Some years ago I also made a highlighter, but forgot to post it anywhere, even though someone added it to http://avisynth.nl/index.php/Syntax_Highlighting#Notepad.2B.2B_Avisynth_Syntax_Highlighting
Here it is: https://sourceforge.net/projects/feos-tas/files/userDefineLang.xml/download
I also couldn't make it properly recognize /* */ as comments, has that been solved by anyone yet?
AzraelNewtype
28th August 2016, 10:18
Not sure where it goes in the xml, but by the time you've already installed it, go to Language>Define Your Language then do this:
http://i.imgur.com/O1EpkYd.png
Then of course just give it whatever visual style you want, probably matching the # type. I don't actually remember what the settings were before this, so no idea what you'll see on opening, but this works for both. I mean, obviously, you could also turn on folding of comments too (I did after taking the screenshot).
feos
28th August 2016, 11:01
Thank you, finally it's working!
anonymlol
13th September 2016, 08:04
I'll post mine, too. I customised it for the Obsidian theme because it's easier on the eyes.
It looks like this:
http://i.imgur.com/HOOuEtMm.png (http://i.imgur.com/HOOuEtM.png)
FredThompson
13th December 2018, 16:22
Over the years I have accumulated 9 AviSynth xml files for Notepad++.
anonymlol's Obsidian theme version is the one I've used. Rustam Musa-Akhunov made a nice auto-complete file (attached).
Has anyone created more complete files for Notepad++ which they will share?
tormento
24th December 2018, 13:29
Ever tried https://www.rizonesoft.com/downloads/notepad3/ ?
Sequel of XhmikosR’s Notepad2-mod and he is a contributor.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.