AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08) (https://forums.alliedmods.net/showthread.php?t=69038)

bl4nk 03-27-2008 06:39

[USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
3 Attachment(s)
This took a while to create. I used a list someone provided for another text editor a long time ago and converted that over to EditPlus for my liking. Since then lots had been added and I was missing a lot of functions and such that should have been highlighted so I decided to get this stuff up to date.

This tutorial was done using EditPlus Text Editor v2.31 (488). If you're not using that exact version, things might be a bit different from you. Hopefully not too much.

How to:
  1. Download the .zip file and extract the two files inside to your EditPlus folder.
  2. Start up EditPlus and go to Tools - Preferences.
  3. Expand the Files category and choose Settings & syntax.
    • Click Add and give it the name SourcePawn.
    • For the file extensions type in sp;inc.
    • Click the ellipsis (...) next to Syntax File and browse to the .stx file you extracted from the .zip (sp.stx).
    • Check the box next to Trim trailing spaces on save.
    • Click the Tab/Indent button and set how many spaces you want to be for each tab/indent (I use 4/4 as opposed to the default 8/8).
    • This is how it should look so far: http://joe.to/~bl4nk/imgs/editplus-1.png
  4. Click the Syntax colors tab.
  5. Back on the category tree choose Templates (still under Files).
    • Add a new template and call it SourcePawn.
    • Click the ellipsis (...) next to File Path and browse to the .sp file you extracted from the .zip (template.sp).
    • You should have something like this: http://joe.to/~bl4nk/imgs/editplus-3.png
  6. Click Apply and then OK and you should be set. You can now make a SourcePawn file by going to File - New - SourcePawn or by clicking the first icon under File and choosing SourcePawn.
You should be all set, but if you want to take it one step further and make it so you can compile your plugin using EditPlus it's not so hard to do. You have to do a little bit outside of EditPlus and then we can get right into it.
  1. Go and download the newest revision of SourceMod and place the compile tools (compile.exe and spcomp.exe) in a folder.
  2. Inside of that folder make a folder called compiled and a folder called include. Place all of your include files in the include directory. The compiled directory is where your compiled files will go.
Now for the EditPlus part.
  1. Go back to into EditPlus and open up Tools - Preferences.
  2. Expand the Tools category and choose User tools.
    • From the drop down box choose an empty group (will be named "Group #" most likely).
    • Click Group Name and name it SourcePawn.
    • Click Add Tool >> and Choose Program from the list.
    • Name the program Compile.
    • Click the ellipsis (...) next to Command and browse to your compile.exe in the folder we talked about earlier.
    • Under Argument type in "$(FilePath)" (quotes included) and under Initial Directory type in $(DirWin).
    • Check the box next to Close widow on exit.
    • This is how it should look (minus the Command path being different for you): http://joe.to/~bl4nk/imgs/editplus-4.png
  3. Click Apply and then OK and you're all done! Now to compile the file your browsing just save it in the folder where your compile.exe is and hit Ctrl-1. The file will compile and the compile window will come up just as normal.
I hope that wasn't too much. I am really picky with things like this so I thought I'd share with you how I set my stuff up properly. I made a few other modifications to my EditPlus (mainly removing unnecessary toolbars and changing a few colors around), but this was the gist of it.

Any questions, feel free to ask.

bl4nk 04-07-2008 16:49

Re: [USEFUL] Syntax Highlighting and More for EditPlus
 
Updated:
  • Added everything up to r2004
  • Added support for the escape (\) character in strings

bl4nk 04-17-2008 12:15

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Updated:
  • Added everything up to r2079 (svn revision 2356)

Nican 04-17-2008 16:21

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Could you show the text of a highlighted code?

bl4nk 04-17-2008 18:33

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
http://www.bl4nk.com/imgs/editplus-highlighting.png

pilger 05-20-2013 16:03

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Great work, bl4nk! Thanks!

Is there a way to make the function list (Ctrl+F11) work on SourcePawn as well!? I'm having great difficulty with it, since it doesn't have the work "function" before the actual functions.

I've tried using:
Code:

^(native[ \t]|public[ \t]|static[ \t]|stock[ \t]|forward[ \t])?[ \t]*(.*)[ \t]\(.*\)[\t]{
Which restricts the "header" of the function to have tabs instead of spaces and force me to put spaces on ifs, elses and other control structures.

Does anyone have an idea on how to improve this!? Make a better regexp to match only function headers!?

Thanks in advance!

mcpan313 05-20-2013 17:49

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Quote:

Originally Posted by pilger (Post 1955283)
Great work, bl4nk! Thanks!
...

This is a very very very old thread, try Notepad++ or Sublime Text.

pilger 05-20-2013 17:52

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
I was aware of the date of the thread when I posted, but it seemed to me that it would be better to post it here than to create a whole different thread just for the simple question.

And switching to a whole different program isn't much what I intent to do. But thanks anyway.

Well, nonetheless my question is a matter of getting a better function prototype detection with regexp. That can be used by any program, really.

bl4nk 05-22-2013 22:28

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Sorry, but I've abandoned using EditPlus in favor of Notepad++ and Sublime Text.

pilger 05-22-2013 22:36

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Sadly I think it's gonna be hard to implemment a decent Function list pattern in Regular Expression for EditPlus, since it still uses a very rudimentar version of regexp and it's full of restrictions.

Since SourcePawn doesn't have a keyword for the function prototype as we see in pretty much all other languages, it's gonna be really hard. I had to come up with a regexp that would negate all the control statements (if, for, while etc.). That could be done on Sublime Text 2, but I doubt it will ever be possible on EP. It's still a very good code editor. The seamless browser is very usefull for web applications and it's one of the most customizable editors around. It's a shame the developers didn't update it in such a fashion to stay competitive. :\

sglee241 08-05-2014 06:28

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
how to update stx? it's been outdated little.

bl4nk 08-05-2014 15:36

Re: [USEFUL] Syntax Highlighting and More for EditPlus (Updated 4/7/08)
 
Quote:

Originally Posted by bl4nk (Post 1956657)
Sorry, but I've abandoned using EditPlus in favor of Notepad++ and Sublime Text.



All times are GMT -4. The time now is 18:47.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.