Page 1 of 1

Editor Highlight Codes

Posted: Mon Feb 15, 2010 11:25 pm
by Spectre
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

Re: Editor Highlight Codes

Posted: Tue Feb 16, 2010 12:31 am
by trepan
I created a bzw.jsf syntax file for the joe editor years ago...

Image

Re: Editor Highlight Codes

Posted: Tue Feb 16, 2010 1:42 am
by joevano
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
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.

Re: Editor Highlight Codes

Posted: Wed Apr 14, 2010 4:12 am
by SkillDude
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:
userDefineLang.zip
(2.77 KiB) Downloaded 337 times
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:

Re: Editor Highlight Codes

Posted: Wed Apr 14, 2010 4:25 am
by Spazzy McGee
I made one that I use with Smultron for mac, made it a couple of years ago.
bzw-smultron.zip
(1.05 KiB) Downloaded 348 times
(Licensed public domain)

Looks like this:

http://img693.imageshack.us/img693/5340 ... ghting.jpg

Re: Editor Highlight Codes

Posted: Wed Apr 21, 2010 4:46 am
by Strakowski
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

Posted: Wed Apr 21, 2010 7:59 am
by zaphod
i agree ::: BIG thanks for sharing Spazzy !!!
whole new experience to look at the map.files :)



.

Re: Editor Highlight Codes

Posted: Sat Jul 03, 2010 1:46 pm
by Yrogirg
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

Posted: Tue Jul 06, 2010 11:01 am
by Yrogirg
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

Re: Editor Highlight Codes

Posted: Tue Jul 13, 2010 7:45 pm
by tobylane
Spazzy McGee wrote:I made one that I use with Smultron for mac, made it a couple of years ago.
bzw-smultron.zip
(Licensed public domain)

Looks like this:

http://img693.imageshack.us/img693/5340 ... ghting.jpg
Does that work with Fraise?

Re: Editor Highlight Codes

Posted: Tue Jul 13, 2010 8:36 pm
by McYukon
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.

Code: Select all

<dict>
	<key>name</key>
	<string>BZW</string>
	<key>file</key>
	<string>bzw</string>
	<key>extensions</key>
	<string>bzw</string>
</dict>
Spazzys .plist for TextWrangler http://cl.ly/6d919157d76a85556426
Copy entire folder to Users>YourUser>Library>Application Support>TextWranger
(Licensed public domain)

Re: Editor Highlight Codes

Posted: Tue Aug 03, 2010 2:31 am
by clarahobbs
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.

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
I'm sure it could be done better; I'm new to the whole "vim syntax files" thing.

Re: Editor Highlight Codes

Posted: Sun Aug 08, 2010 3:25 am
by ahs3
Yrogirg 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.
Very nice thanks Yrogirg

Re: Editor Highlight Codes

Posted: Sun Aug 22, 2010 7:23 pm
by optic delusion
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.

Re: Editor Highlight Codes

Posted: Thu Jul 14, 2011 6:29 pm
by Yrogirg
Optic 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.
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 called

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

Posted: Tue Feb 17, 2015 2:53 am
by allejo
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

Re: Editor Highlight Codes

Posted: Tue May 02, 2017 2:24 am
by allejo

Re: Editor Highlight Codes

Posted: Fri Aug 18, 2017 5:05 pm
by allejo
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