Editor Highlight Codes
Editor Highlight Codes
Though BZEdit and its counterparts have taken over the BZWorld, a few of us still enjoy hand coding. However, some of us who enjoy it have trouble organizing our maps (what are you looking at?). Therefore, I had an idea: highlighting codes!
Many text editors support language files telling them what to highlight in what color according to a programming language, such as Python, Perl, or C. If this is doable for BZW as part of BZFlag downloads, perhaps bundled with BZFS, please consider it. It would help a lot. If you could give me some reasons why it can or cannot be done, that would be great. Thanks!
-Anathema
Many text editors support language files telling them what to highlight in what color according to a programming language, such as Python, Perl, or C. If this is doable for BZW as part of BZFlag downloads, perhaps bundled with BZFS, please consider it. It would help a lot. If you could give me some reasons why it can or cannot be done, that would be great. Thanks!
-Anathema
Keeping Latin alive in 2766 AUC.
Re: Editor Highlight Codes
I created a bzw.jsf syntax file for the joe editor years ago...
Re: Editor Highlight Codes
It can and should be done... this is open source software, and the open source spirit is to do it and not wait on someone else. So everyone get cracking on getting bzw syntax highlighting going for your favorite text editor (that supports it) and post them here to share with others.Anathema wrote:Though BZEdit and its counterparts have taken over the BZWorld, a few of us still enjoy hand coding. However, some of us who enjoy it have trouble organizing our maps (what are you looking at?). Therefore, I had an idea: highlighting codes!
Many text editors support language files telling them what to highlight in what color according to a programming language, such as Python, Perl, or C. If this is doable for BZW as part of BZFlag downloads, perhaps bundled with BZFS, please consider it. It would help a lot. If you could give me some reasons why it can or cannot be done, that would be great. Thanks!
-Anathema
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
Re: Editor Highlight Codes
Notepad++ fans, here is a custom syntax coloring for this program.
Since Notepad++ is only for windows users, I might be able to write up something for another programming language for another editor, or perhaps integrate it into another program somehow. (What does everyone else use, out of curiosity?) Meanwhile, I have Notepad++ for people that want it.
How to add to Notepad++:
Download: Unzip the userDefineLang.xml file in the zip folder.
Go to Start -- > Run
Type In: explorer %APPDATA%\Notepad++
Place the unzipped userDefineLang.xml file in the folder that opened
The next time you open up a bzw file with Notepad++, there will be syntax coloring. Easier to read and see things
Screenshots:
Since Notepad++ is only for windows users, I might be able to write up something for another programming language for another editor, or perhaps integrate it into another program somehow. (What does everyone else use, out of curiosity?) Meanwhile, I have Notepad++ for people that want it.
How to add to Notepad++:
Download: Unzip the userDefineLang.xml file in the zip folder.
Go to Start -- > Run
Type In: explorer %APPDATA%\Notepad++
Place the unzipped userDefineLang.xml file in the folder that opened
The next time you open up a bzw file with Notepad++, there will be syntax coloring. Easier to read and see things
Screenshots:
- Attachments
-
- syntax.PNG
- (36.81 KiB) Not downloaded yet
-
- syntax2.PNG
- (48.07 KiB) Not downloaded yet
- Spazzy McGee
- Sergeant Major
- Posts: 1405
- Joined: Mon Mar 21, 2005 4:59 pm
- Location: Planet MoFo, Sheffield Division; United Kingdom
Re: Editor Highlight Codes
I made one that I use with Smultron for mac, made it a couple of years ago.
(Licensed public domain)
Looks like this:
http://img693.imageshack.us/img693/5340 ... ghting.jpg
(Licensed public domain)
Looks like this:
http://img693.imageshack.us/img693/5340 ... ghting.jpg
"Life is what happens to you while you're busy making other plans." - John Lennon
- Strakowski
- Private First Class
- Posts: 79
- Joined: Wed Jun 24, 2009 4:40 pm
- Location: hiding somewhere in Overdoze
Re: Editor Highlight Codes
Man, thanks for that smultron library, Spazzy, I wish I had had this before! Much better than using textedit. It's too bad that there is no way for smultron to distinguish any more objects than keywords without starting and ending elements, but it still makes BZWs much more navigable as it is.
Re: Editor Highlight Codes
i agree ::: BIG thanks for sharing Spazzy !!!
whole new experience to look at the map.files
.
whole new experience to look at the map.files
.
Re: Editor Highlight Codes
I wonder if there .lang file for GtkSourceView. Maybe there was bzeditor with it? If so, it could be used for gedit.
Re: Editor Highlight Codes
Well, I've made .lang file for GtkSourceView. So now you can have syntax highlighting at least in gedit. Gedit is available both for linux and windows.
It also highlights bzfs command line options so could be used to edit configs.
To install the file in Ubuntu copy it into /usr/share/gtksourceview-2.0/language-specs. There is also a way to put it into your home directory if you have no root password, but I don't remember it.
It was hard to make proper highlighting in drawInfo, so there is no.
UPD I've updated the file to include some missing keywords and 2.4 stuff
It also highlights bzfs command line options so could be used to edit configs.
To install the file in Ubuntu copy it into /usr/share/gtksourceview-2.0/language-specs. There is also a way to put it into your home directory if you have no root password, but I don't remember it.
It was hard to make proper highlighting in drawInfo, so there is no.
UPD I've updated the file to include some missing keywords and 2.4 stuff
- Attachments
-
- bzflag.lang.zip
- (3.39 KiB) Downloaded 642 times
-
- bzwgedit.png
- screenshot
- (120.19 KiB) Not downloaded yet
Last edited by Yrogirg on Thu Jul 14, 2011 6:19 pm, edited 5 times in total.
Re: Editor Highlight Codes
Does that work with Fraise?Spazzy McGee wrote:I made one that I use with Smultron for mac, made it a couple of years ago.
(Licensed public domain)
Looks like this:
http://img693.imageshack.us/img693/5340 ... ghting.jpg
- McYukon
- Private First Class
- Posts: 46
- Joined: Mon May 11, 2009 3:12 am
- Location: Whitehorse, YT
- Contact:
Re: Editor Highlight Codes
Yep,
Right click on the Fraise application and choose "Show Package Contents". Drop the bzw.plist into /Contents/Resources/Syntax\ Definitions. Then open the SyntaxDefinitions.plist under the Syntax Definitions folder and add this code.
Spazzys .plist for TextWrangler http://cl.ly/6d919157d76a85556426
Copy entire folder to Users>YourUser>Library>Application Support>TextWranger
(Licensed public domain)
Right click on the Fraise application and choose "Show Package Contents". Drop the bzw.plist into /Contents/Resources/Syntax\ Definitions. Then open the SyntaxDefinitions.plist under the Syntax Definitions folder and add this code.
Code: Select all
<dict>
<key>name</key>
<string>BZW</string>
<key>file</key>
<string>bzw</string>
<key>extensions</key>
<string>bzw</string>
</dict>
Copy entire folder to Users>YourUser>Library>Application Support>TextWranger
(Licensed public domain)
MacBook Pro Uni Late 2008, 2.4Ghz, 4GB Ram, Mac OS 10.6.5
- clarahobbs
- Private First Class
- Posts: 272
- Joined: Thu Jan 10, 2008 1:45 am
- Location: The Fourth Dimension
Re: Editor Highlight Codes
I have a BZW syntax file for Vim that I've been working on for a while. It's far from complete, but do what you want with it. In other words, this has no copyright or anything.
I'm sure it could be done better; I'm new to the whole "vim syntax files" thing.
Code: Select all
syntax case match
syntax match Comment "#.*"
syntax keyword keyword end
syntax keyword keyword world options waterLevel dynamicColor textureMatrix
syntax keyword keyword transform material physics define group mesh meshbox
syntax keyword keyword meshpyr arc cone sphere tetra box pyramid link
syntax keyword keyword teleporter base weapon zone koth face endface
syntax match Number "\<[-]\d\+\([+-]\+\)\=\>"ms=s,me=e
syntax match Number "\<\d\+\([+-]\+\)\=\>"ms=s,me=e
FKA Ratfink
- ahs3
- Private First Class
- Posts: 327
- Joined: Sun Mar 04, 2007 8:33 pm
- Location: Press '/' to search
- Contact:
Re: Editor Highlight Codes
Very nice thanks YrogirgYrogirg wrote:Well, I've made .lang file for GtkSourceView. So now you can have syntax highlighting at least in gedit. Gedit is available both for linux and windows.
It also highlights bzfs command line options so could be used to edit configs.
To install the file in Ubuntu copy it into /usr/share/gtksourceview-2.0/language-specs. There is also a way to put it into your home directory if you have no root password, but I don't remember it.
It was hard to make proper highlighting in drawInfo, so there is no.
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
Re: Editor Highlight Codes
Spazzy tried to get me to convert to smultron (mac) awhile ago. I should have. It's good, and open source. I used textwrangler, which has more features, but i never used them.
Now for my feature request. (heh!)
What we need is a macro to add #comment markers to a selected block of text. If it added this "#_ " , we could use the find-replace to remove them, so it would not need a removal macro.
Now for my feature request. (heh!)
What we need is a macro to add #comment markers to a selected block of text. If it added this "#_ " , we could use the find-replace to remove them, so it would not need a removal macro.
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Re: Editor Highlight Codes
Well, after years of using gedit I've just found out that it has plugins! Moreover there is quite a number of them, featuring rather powerful capabilities. Among the plugins there is one calledOptic Delusion wrote: Now for my feature request. (heh!)
What we need is a macro to add #comment markers to a selected block of text. If it added this "#_ " , we could use the find-replace to remove them, so it would not need a removal macro.
Code Comment: Comment or uncomment blocks of code.
It does what you are looking for, though for gedit, but gedit is available for macs too. You can comment and uncomment with Ctrl+M and Ctrl+Shift+M respectivly, or through the "Edit" menu. To work for a particular language it requires an appropriate syntax highlighting file, so in case of bzflag you have to download and install "bzflag.lang".
Ubuntu users can install gedit-plugins from the repositories.
NOTE: I've updated the bzflag.lang file in my previous post.
Re: Editor Highlight Codes
I've started a .tmLanguage file just to play around and to learn how to make one. It's far from perfect but any app that supports .tmLanguage files, here you go
https://github.com/allejo/SublimeBZW
https://github.com/allejo/SublimeBZW
Re: Editor Highlight Codes
- Attachments
-
- bzw.min.js
- (4.31 KiB) Downloaded 420 times
-
- bzw.js
- (6.79 KiB) Downloaded 409 times
Re: Editor Highlight Codes
If you use Sublime Text 3, I've submitted a more up to date syntax definition than my original attempt. If you use ST3, chances are you have Package Control installed so just look for "BZW" and you'll be set.
https://packagecontrol.io/packages/BZW%20Language
https://packagecontrol.io/packages/BZW%20Language