Sublime Text - editor (Windows, Mac OS X, Linux)

Monkey Forums/Monkey Programming/Sublime Text - editor (Windows, Mac OS X, Linux)

matt(Posted 2011) [#1]
Sublime Text is an editor which is has been getting a lot of press and attention on Twitter and various technology blogs recently.

http://www.sublimetext.com
Sublime Text is a sophisticated text editor for code, html and prose. You'll love the slick user interface and extraordinary features.

http://www.sublimetext.com/blog/articles/sublime-text-2-public-alpha
Sublime Text 2 is available now as a public alpha, for Windows, OS X, and Linux.

Support for monkey is possible in Sublime Text using files I originally created for use with TextMate, the well-known Mac OS X editor:
http://www.monkeycoder.co.nz/Community/posts.php?topic=69

Feature-wise Sublime Text is quite comparable with TextMate:
http://www.sublimetext.com/features

You can download my Sublime Text package from GitHub, which will enable monkey support:
https://github.com/gingerbeardman/monkey.sublime

It supports a subset of my TextMate bundle at this time. For now there is Syntax Highlighting (with a few small issues that will be addressed), Snippet Expansion using the tab key, with Auto Completion, Context Help and Build process to follow soon.

Any feedback appreciated.

Cheers,
matt


slenkar(Posted 2011) [#2]
I put the files in a folder called monkey inside data/packages

I tried to run the snippet that compiles to html5
nothing happened

tried again
it crashed

I was clicking on it, are you suppsed to type in h,t,m,l,5 or something?


matt(Posted 2011) [#3]
edit: ah there were some snippets left in the package that inserted the buildopts text variations (this only applies to TextMate). I've removed them as they are not relevant to Sublime Text. Sorry for any confusion caused!

There is currently no support in my package for building, you'll have to do that from the command line until I add in support for doing that from Sublime Text.

A snippet is a small piece of code that can be inserted into the current document. There is no snippet that does anything other than insert text.

Here snippets are attached to the tab key so you can type, say, if<tab> and get a whole if structure. Successive presses if the tab key will jump you through the if structure so you can easily enter the conditional and code in each branch without having to move the cursor.


Difference(Posted 2011) [#4]
Thanks. this is a great addition. Seems to run well on Snow Leopard.

Looking forward to the build options! :-)


slenkar(Posted 2011) [#5]
yesh ,me too


RetroRusty(Posted 2011) [#6]
Any news on the build options being put in?


matt(Posted 2011) [#7]
It's working, but the location of trans has to be hardcoded for some reason. Also, only one command line parameter can be used. I'd like to solve both issues and so will continue to look at them.

What I have so far is on github: https://github.com/gingerbeardman/monkey.sublime

You will have to edit the Monkey.sublime-build file.

Let me know how you get on.


matt(Posted 2011) [#8]
Multiple parameters added thanks to Adam Woodall/qcat

Still looking into the PATH issue


RetroRusty(Posted 2011) [#9]
Is TextMate fully working now or are you still working on some problems with it?


matt(Posted 2011) [#10]
TextMate is very much working, always has been. There are some small syntax highlighting tweaks I will eventually get around to, but they're a real minor issue and don't prevent normal operation in any way.


matt(Posted 2011) [#11]
Path issue solved, requires a bit of command line work during installation.

https://github.com/gingerbeardman/monkey.sublime

Let me know how you get on.


Shagwana(Posted 2011) [#12]
How do we get this working on Windows?.

On windows 7 I have placed the contents of the zip file into;

C:\Users\<useraccount>\AppData\Roaming\Sublime Text 2\Packages

When sublime loads a monkey file, I can see the hi-lighted comments.

F7 to build it causes a 'error 2: The system cannot find the file specified'

I guess my next port of call is to setup a PATH enviroment var.


Qcat(Posted 2011) [#13]
I have not tryed this on windows but setting the path environment to your monkey\bin will do the job I think!

If not you can add the path to the Monkey.sublime-build file.

I am not back at home till tomorow night but will be happy to help then if you still have problems.


Shagwana(Posted 2011) [#14]
Adding the monkey bin folder to the PATH environment solved the issue indeed.


matt(Posted 2011) [#15]
I've added a note to the readme about that, cheers


matt(Posted 2011) [#16]
This has just been updated with the changes done for monkey.tmbundle. Syntax colouring is much improved!

https://github.com/gingerbeardman/monkey.sublime

Let me know how you find it.

ps: here's a link to my preferred syntax coloring theme:
http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/


matt(Posted 2011) [#17]
Updated for v40, added support for Sound.Discard

Download details in the post directly above


slenkar(Posted 2011) [#18]
it doesnt seem to do anything when i press build,

what features of this editor do you use?


matt(Posted 2011) [#19]
Have you followed the installation instructions? You need configure your PATH to or build will not work.

It uses the follow editor features: language definition, preferences, snippets and build system.
I am looking at using the keymap for context sensitive help in the future.


slenkar(Posted 2011) [#20]
I simply copied the files to data/packages/monkey

Does anything else have to be done?

In build options I saw monkey, i selected it also,
but nothing seems to happen upon build


matt(Posted 2011) [#21]
You have only done half the install.

Please read the instructions in the README that comes in the zip.
They are displayed here: https://github.com/gingerbeardman/monkey.sublime

You need to configure your PATH or build will not work.


Difference(Posted 2011) [#22]
Thank you very much for maintaining this.

Is there an easy way to switch between targets or is the only way still to edit the Monkey.sublime-build file?


matt(Posted 2011) [#23]
That's the only way for now, but if you want to hack in different build processes or hotkey support then feel free!


matt(Posted 2011) [#24]
I've just added in multiple build processes (simply duplicating the html5 one, renaming and editing the command calls). That will have to do for now.

It *should* default to HTML5 (but may not do) and can of course be set manually through the Tools/Build System menu.

https://github.com/gingerbeardman/monkey.sublime


Difference(Posted 2011) [#25]
Thanks!

I've tested builds for Android, iOS, GLFW, Html5 and Flash on Snow Leopard, and they all work perfectly.


matt(Posted 2011) [#26]
Sweet!


OvineByDesign(Posted 2011) [#27]
Can you clarify the setup instructions for a new Mac user? It's not entirely clear.



* Unzip to "Application Support/Sublime Text".
I found this in the Library folder after some searching, but I ended up putting the unzipped files in a sub-folder called Packages and created in there a new folder called Monkey. Is this correct? It seems to have worked for me doing this.


* Next, you will need to add your monkey/bin folder to your system wide path. This is currently a bit awkward but will hopefully become easier as Sublime Text continues to be improved.
*
* ### Path
* You will first need to confirm your monkey/bin location is in your shell path:
*
* echo "export PATH=\$PATH:/user/folder/monkey/bin" >> ~/.profile

Is this with Terminal I assume? Should I change the $PATH:/user/folder/monkey/bin part ? Should I get some output after entering this?


* Next, add the shell path to the system-wide environment:
*
* defaults write ${HOME}/.MacOSX/environment PATH "${PATH}"

Again, not sure?


* Alternatively, you can manually edit `~/.MacOSX/environment.plist` or use the [RCEnvironment](http://www.rubicode.com/Software/RCEnvironment/) preference pane.

I've tried grabbing this tool but exactly what do I enter and where. This preference pane has many tabs and options!

Might make sense to a seasoned Mac user but not to a Windows user :)

The sytax highlighting and intellisense works but when I try to build it does not work and I get this:

[Errno 2] No such file or directory
[Finished]


matt(Posted 2011) [#28]
Hi,

If the syntax is working then it's installed OK. As long as it's in Packages that's fine, the exact directory hierarchy inside Sublime Packages doesn't matter.

You're just falling over editing your path as signified by the Error from Sublime Text 2. So, in Terminal:

<code>echo "export PATH=\$PATH:/user/folder/monkey/bin" >> ~/.profile</code>
Change "/user/folder/monkey/bin" to your own location of where the monkey/bin folder is.
There will be no output after entering this.

Next, either the following line in Terminal:
<code>defaults write ${HOME}/.MacOSX/environment PATH "${PATH}"</code>
No user changes needed that command. This command duplicates the changes above to a separate location.

OR, use add your monkey/bin path to the end of the PATH variable in your environment using RCEnvironment as follows:
http://cl.ly/3z0Y0Y1X2c153C3X3b2C

Let me know how you get on. I've updated the documentation in response to your feedback.

Cheers,
matt


OvineByDesign(Posted 2011) [#29]
OK, got it working now. Thanks for the help. For info, it seems I had downloaded the wrong thing from the RCEnviroment link which doesn't help. Once I got that I could see the duplicates of what was in my PATH variable, deleting the incorrect ones has solved the problem and it builds now.

Looks and works great, thanks!

One last quetion, is there any way to stop the simulator popping up after you build for iOS?


matt(Posted 2011) [#30]
You can edit any of the build systems and remove the "-run" parameter.


Xaron(Posted 2011) [#31]
Hi, I might be a bit stupid (new to Mac as well) but if I download the "Sublime Text 2 Build 2076.dmg" file I just have one file unpacked called "Sublime Text 2".

I can't find any other application related folders in the Library... I had the impression that some kind of installer would run (like for other packages like Google Chrome and so on) but nothing happened actually. So obviously I did something wrong here. ;)

So as far as I understand I just open the dmg (which is some kind of archive) and move the sublime app to my programs folder where it runs ok. But I still don't know where to put the monkey files above... THANKS!

Another question: As I see you maintain Textmate as well. Which would you prefer or do you continue maintaining both?


matt(Posted 2011) [#32]
Welcome new Mac user! :)

You've installed Sublime Text 2 correctly. The dmg is a disk image which is kind of like an iso that never quite made it onto a disc: http://en.wikipedia.org/wiki/Apple_Disk_Image copying an app out of a disc image into your Applications folder is a common Mac thing to do.

The monkey files go here: ~/Library/Application Support/Sublime Text 2/Packages/
(~ is a Unix thing, and is a shorthand representation of the location of your home folder, eg. /Users/matt/ )

I've clarified this in the readme, thanks for bringing it to my attention.

As a long-time user I prefer TextMate, but the Sublime Text 2 package is directly related (it's a subset of the TextMate bundle actually) so I will be maintaining both. I'll also be doing syntax packages for Xcode and BBEdit/TextWrangler as time allows.


Xaron(Posted 2011) [#33]
Thanks Matt, very kind of you!

I already knew Linux before but some stuff is a bit different, even though not that much. From time to time I still feel more comfortable with the console. ;)

Unfortunately I don't have a folder "Application Support/Sublime Text 2/Packages/" within my Library folder so I assume I have to create it? I just had the impression Sublime would create it during the first start? (I just have my parallels folder within the library).


matt(Posted 2011) [#34]
I'm not too sure about why you might not have the Packages folder, mine contains 49 packages for various languages from ActionScript and AppleScript to YAML and ZenCoding.

See how you get on with it, and maybe ask over at the ST2 forum...


skid(Posted 2011) [#35]
Apparently ~/Library is now hidden in Lion, maybe this is the problem.


matt(Posted 2011) [#36]
Ah, yes, to unhide ~/Library/ in your home directory, do this in terminal:

chflags nohidden ~/Library/



hardcoal(Posted 2011) [#37]
wow thats great news ..
another editor..
lets see what its worth..


Xaron(Posted 2011) [#38]
Thanks guys, will try that!


FlameDuck(Posted 2011) [#39]
This is awesome. Keep up the good work.


matt(Posted 2011) [#40]
Thanks, will do.

FYI the TextMate bundle is even more fully featured.


clevijoki(Posted 2011) [#41]
This is great, I have never seen this editor before, will give it a whirl


matt(Posted 2011) [#42]
I've just rolled out an update to this, as it's related to monkey.tmbundle that I've just given a "massive" update.

https://github.com/gingerbeardman/monkey.sublime

What do these changes mean to the user? Faster and more accurate syntax highlighting. There was an issue with wrong syntax colouring if you used If...Then statements with no EndIf. This is now fixed.

2011-08-08
- Added else/elseif snippet
- Reduced number of foldable elements
- Added keyEquivalent ^&#8997;&#8679;+M to activate bundle
- Renamed bundle from monkey to Monkey
- Removed preprocessor grammar
- Removed framework grammar
- Removed module grammar
- Added better if/then/elseif/else/endif handling
- Added bitwise complement operator
- Removed superstrict reference
- Tidied block comment grammar
- Replaced instances of (?:(?:^|;)\s*) with neater \b (regexp boundary)
- Removed references to integer number symbol %
- Corrected PI constants regexp
- Removed pointerops grammar
- Removed unused types from types grammar


arcsrc(Posted 2011) [#43]
damn, now i need to switch from Monkey-Emacs to Sublime Text... ;)


maverick69(Posted 2011) [#44]
Using Sublime for quite some time for AS3-Developement - cool to see a monkey bundle for it :-) Will Download it now!

Thanks!


FlameDuck(Posted 2011) [#45]
Oh matt. And on my birthday too! You really shouldn't have... :)


matt(Posted 2011) [#46]
Happy Birthday! :)

I also released the BBEdit and TextWrangler packages today.


matt(Posted 2011) [#47]
I've created a table of features so people can more easily see what each of my packages do:

It's at my website: http://www.gingerbeardman.com/monkey/


matt(Posted 2011) [#48]
Lots of changes in the latest version, thanks to sister package monkey.tmbundle:

https://github.com/gingerbeardman/monkey.sublime

2011-10-08
- Added FirstNode, LastNode, NextNode, PrevNode, Exp (v45c)
- Added DisableKeyboard, EnableKeyboard (v45)
- Added ACosr, ASinr, ATan2r, ATanr, Cosr, Sinr, Tanr (v44)
- Added DrawPoly (v43)
- Added App: UpdateRate
- Added Audio: music commands (v35), Discard
- Added Graphics: DeviceHeight, DeviceWidth, Frames, HandleX, HandleY, Height, Width
- Added Lang: Print, Length, Resize, Compare, ToLower, ToUpper, Trim
- Added List: Backwards, Clear, Count, First, IsEmpty, Last, LastNode, ObjectEnumerator, RemoveFirst, RemoveLast, Value, ToArray
- Added Map: Set, Values, Key
- Added Random: Seed
- Added Set: Insert
- Added Stack: Insert, Pop, Push, Top


AaronK(Posted 2011) [#49]
Hi Matt, great work.

I'm new to TextMate and noticed that when I set build options it actually inserts comments into my Monkey Code to drive it. Is this the only way it works? The reason being for clean builds. It inserted the buildopt, builds clean, but then it leaves it there.

Additionally, is there a way to stop that annoying empty editor window popping up after every build. :)

Many thanks


matt(Posted 2011) [#50]
I've reposted the question in the TextMate thread to keep things on topic

http://www.monkeycoder.co.nz/Community/posts.php?topic=69


rhuk(Posted 2011) [#51]
Hey matt, great work on this. What's the chances of getting this added to the Sublime Text 2 Package Manager?

http://wbond.net/sublime_packages/package_control

cheers!


matt(Posted 2011) [#52]
Shouldn't be a problem - I'll add it when I get a chance.

Thanks for letting me know about their Package Manager.


rhuk(Posted 2011) [#53]
nice, it's a great way to stay on top of updates. cheers!


slenkar(Posted 2011) [#54]
how do you install the monkey package for sublime 2 on windows?

In the readme it just says include the PATH
it doesnt say what to do with the monkey.sublime folder

ok so you have to copy the contents to:
C:\Documents and Settings\Owner\Application Data\Sublime Text 2\Packages\Monkey

can the build path have spaces?
my monkey folder is in c:/my dropbox/monkey
i have my game in c:/my dropbox/monkey also and its not compiling


matt(Posted 2011) [#55]
It's monkey teams that you have to put in the PATH. What is the error message?

Can you confirm from the command line that PATH has been set correctly? ie. can you run trans from the command line?


slenkar(Posted 2011) [#56]
yes I went into the command line and ran trans_winnt
even though the current directory was c:\

in my path I have
c:\my dropbox\monkey\bin

EDIT- ah I had to restart the PC, thanks!


matt(Posted 2011) [#57]
Glad you got it sorted


slenkar(Posted 2011) [#58]
is it possible to get a view of classes and methods in a sidebar?
(like monk)


matt(Posted 2011) [#59]
To do that in Sublime Text 2, use the Find/Goto menu. There are a few options there - symbols (classes/methods) and words (keywords). They are presented in an ST2 popup menu, rather than being attached to the window like in other editors.

It's worth taking the time to explore ST2's menu system and documentation ;)


slenkar(Posted 2011) [#60]
ah nice one
this makes it better than monk cos monk doesnt recognize standalone functions in its sidebar

sublime doesnt seem to recognize

end select

or

endif

or

end class


matt(Posted 2011) [#61]
I agree - Sublime with my bundle is better than Monk.
TextMate is even better than Sublime, as it supports even more features.
You can compare them: http://www.gingerbeardman.com/monkey/

The bundle only recognises long/verbose End statements, ie. End Class rather than End. Both are valid Monkey code. But the syntax parser seems to get confused sometimes with End If statements. The result is wrongly coloured End statements in the document after the rogue EndIf statement.

I have fixed it in the past but it seems to revert for some reason to do with the order of the definitions and the fact that the bundle editor reorders them without me knowing. I'll roll out a tweaked version when I get time.

The workaround is to check all your EndIf statements and put up with them being wrongly coloured until I can roll out a fix.

This is only an issue with Sublime Text 2 (and not the related TextMate bundle) so you might want to report it to the developer of ST2.

problem


workaround



slenkar(Posted 2011) [#62]
ah ok

it says Monk has auto-completion in that graph, but it doesnt :)


matt(Posted 2011) [#63]
In Monk press Escape to see the list of completions of a half-typed word.

It's limited, but it's there. (At least on Mac OS X, I've not checked Windows)


matt(Posted 2012) [#64]
https://github.com/gingerbeardman/monkey.sublime

2012-05-04
- Added DrawPoint (v50)
- Included current TextMate language grammar

The final items means there are some worthwhile syntax highlighting improvements.


fsoft(Posted 2012) [#65]
Succeded in installing Sublime Text and your package on Linux (also build works).

Actually, I don't see the point in yet another editor. Where is the catch? Sublime doesn't seem to have any "cool" feature I'd switch over Vim ...


matt(Posted 2012) [#66]
If you can't see any benefits then it's probably not for you.


GC-Martijn(Posted 2012) [#67]
today , (because I had to reinstall windows) i installed the sublime again.
then I donwloaded the zipfile and placed it in the correct dir.

Then after restarting sublime I get more then 30 errors popups with this text:

Error parsing snippet: Error parsing plist xml: Error document empty.
In file "Package/monkey.sublime/Snippets/._ValueForKey.tmSnippet" In file Packages/monkey.sublime/Snippets/._ValueForKey.tmSnippet

And many other files like:
._While__Wend.tmSnippet
._UpdateRate.tmSnippet
......

Maybe the new sublime needs some other syntax ?


fsoft(Posted 2012) [#68]
Can you do stuff like this in Sublime? :-)

[img]

[/img]

Full image can be downloaded here:

www.rotondo.it/terminator-full.png



matt(Posted 2012) [#69]
@GC-Martijn I must have forgotten to clean the zip of those unnecessary dot files. Try downloading the zip through the GitHub zip button rather than my dated zip upload.

@fsoft this isn't the place for editor comparisons, please take it elsewhere. thanks.


GC-Martijn(Posted 2012) [#70]
@matt, I will try.

@fsoft, I choose my editor by how it feels and looks.
I will not use a editor if I hate the GUI/text font and the lack of fast compiling shortcut
(monk editor still needs to know everytime how to compile)

I really like the sublime gui and the text font with nice colors.
So everytime its fun to program with it ;)

As you can see, its not always about how many features something has.


Shinkiro1(Posted 2012) [#71]
Hey, I recently tried sublime and really liked it. I think I want to switch from TM over to it, it just feels better, as GC-Martinj mentioned.
However, I can't get it to compile. I got stuck with the PATH variable (i read the how to on gituhub). What do I have to do exactly to make sublime build?

@fsoft
I would never want to work in an environment like that. It's not about one can do as many things as you want, actually an application should restrict the user to meaningful choices the developers have proved to be productive. I am not saying VIM is a bad editor, just for me personally I would never consider using it.
(and yes, you can do that in sublime, it just looks more elegant ;))


matt(Posted 2012) [#72]
@Shinkiro1 can you let me know the output of
echo $PATH
in Terminal?


Shinkiro1(Posted 2012) [#73]
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/user/developer/monkey/bin

Seems wrong. I'm using this ...
echo "export PATH=/Users/shinkiro1/Developer/monkey/bin" >> ~/.profile



matt(Posted 2012) [#74]
Have you rebooted?

(you also need to manually remove the old monkey location from path: /user/developer/monkey/bin


Shinkiro1(Posted 2012) [#75]
Rebooting fixed it. I manually edited the plist file in ~.MacOS/environment.plist
key
PATH

value
/Users/shinkiro1/Developer/monkey/bin/


It compiles fine, however it won't run.
Console output for html5 (other targets won't run either).
TRANS monkey compiler V1.34
Parsing...
Semanting...
Translating...
Building...
sh: open: command not found
[Finished]


Any ideas?

EDIT: I just have to say thanks matt. Without your contributions monkey on osx wouldn't be that good. It's not much but I emptied my paypal account for a little donation. Thanks.


matt(Posted 2012) [#76]
Thanks for the donation! You're welcome.

As to your error, it's odd as open is a system wide command.

What do you get if you do this in Terminal?

open .

It should open Finder at the directory you are currently in.


Shinkiro1(Posted 2012) [#77]
okay, I may have messed up a lot here.
-bash: open: command not found

Now I can't even compile glfw apps in monk anymore. I think I overwrote some system wide variables. oops. How do I restore this to default again?

EDIT: okay, not too bad. Just my $PATH variable is messed up, so I can't type open but have to use the full path (/usr/bin/open). My current $PATH is set to /Users/shinkiro1/Developer/monkey/bin

EDIT2: everything resolved now. I resetted the environment variables by deleting every entries i have added to the ~profile file, restarted and now everything works fine again.


matt(Posted 2012) [#78]
Super. Glad you got it sorted.


Shinkiro1(Posted 2012) [#79]
Just a note: The reason I messed this up was that it wasn't clear to me what I had to replace:
echo "export PATH=\$PATH:/user/folder/monkey/bin" >> ~/.profile

Make it apparent that '/user/folder/monkey/bin" has to be replaced by the use.
Maybe in bold/italics and add a note that this should be set to your monkey folder.

Anyway, Sublime2 is awesome.


muddy_shoes(Posted 2012) [#80]
Is there any reason why I'd get this:

[Errno 2] No such file or directory
[Finished]

...when building other than the path to the binary being incorrect? I've added the monkey bin directory to the path and restarted and I can access trans_macos in terminal without specifying the path but I still get that error.


matt(Posted 2012) [#81]
That sounds like a path error. Annoying that ST2 doesn't say which file is missing...

Have you rebooted after changing your path?

And can you confirm your path is set correctly in:
~/.MacOSX/environment.plist

Please paste your full path here if you're unsure.

You can check the path inside ST2 as follows.
1. View menu: Show Console
2. Type: import os
3. Type: os.environ["PATH"]

Please confirm.


Shinkiro1(Posted 2012) [#82]
Got this too when the path wasn't set right.

@matt
Have you noticed that in both Textmate and Sublime2 the highlighting sometimes screw up.
I tested a little bit and came to this conclusion:
[monkeycode]
'If you remove else it works fine
If (a = 1)

Else

End

'Doesn't work
If Not a Return

'Works
For Local i:Int = 0 Until 10

Next 'End doesn't work

'Works
While a

Wend 'End also works
[/monkeycode]

I will look into this myself but wanted to let you know.


matt(Posted 2012) [#83]
Yes, the issue is with "short" end statements. Why? Simply because I cheat a bit with the syntax rules.

Workaround: using "End If" or EndIf should fix it. I prefer to use the longer end statements as it makes things more readable...

I have a version in development that should fix this, and adds proper code folding and function/class/method lookup. I'm really busy so there's no date on when this will see public release. There are some (other!) outstanding issues with syntax colouring in the forthcoming version - see the TextMate thread.

Though let me know if you want the WIP version. If you were happy to work in Github I'd happily let you have it with the expectation that you pushed any worthwhile changes you made. Cheers.


Shinkiro1(Posted 2012) [#84]
Very excited about the next version. You don't have to give me the WIP, take your time.


matt(Posted 2012) [#85]
OK, cheers


muddy_shoes(Posted 2012) [#86]
Looks like the environment.plist is the problem. It wasn't/isn't updated correctly by the "defaults write" line. I'll have to do some investigating to see if it's in some weird state as I don't know what it's supposed to look like.

Edit: I needed to do "${PATH}" without the quotes. Working now.


matt(Posted 2012) [#87]
Cool.


RetroRusty(Posted 2012) [#88]
I need some help. I've copied the contents of the zip into the packages folder and I've added monkey/bin to my path, but when I load Sublime Text 2 I get 'Error parsing snippet: Error parsing plist xml: Error document empty. In File' on every file in the snippets folder.


matt(Posted 2012) [#89]
See post 69 of this thread. http://www.monkeycoder.co.nz/Community/post.php?topic=593&post=28766

I will upload a cleaned zip when I get time (I'm away for WWDC right now)


RetroRusty(Posted 2012) [#90]
@matt Thanks for your help, that has worked.


Samah(Posted 2012) [#91]
I've updated the PATH variable in my .profile and the system environment variables and rebooted.

os.environ["PATH"] gives me:
'/usr/bin:/bin:/usr/sbin:/sbin'

But echo $PATH in a terminal gives me:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Shane/Repositories/Monkey/monkey/bin

GRRRRRR!!!!!

Running Sublime Text 2 on Lion.

EDIT: I gave up and just hacked the full path to trans_macos in the sublime build configs.


matt(Posted 2012) [#92]
The two will be different, by design.

Have you done both terminal commands listed in the readme?
echo (to .profile)
defaults write (to environment)

Not doing the second one will mean that your environment path - the one used by windowed apps such as Sublime - will not be updated.

The easiest way to make sure it's correct is to use RCEnvironment to modify the environment PATH

I'll revise the docs to stress this, as it comes up so often.


matt(Posted 2012) [#93]
OK, docs updated: https://github.com/gingerbeardman/monkey.sublime

I've also cleaned the zip to fix the issue mentioned in post #69


Samah(Posted 2012) [#94]
Yes I added it to my .profile and to the environment path (RCEnvironment confirms this). It's working with full path now so I don't care anymore. :)
Thanks, though. Great work with this!


matt(Posted 2012) [#95]
There's definitely an oddity on your Mac, then. RCEnvironment should show exactly the same PATH contents as os.environ["PATH"], as they refer to the same thing.

You'll have to remember to change the path with each new version of the package/bundle.

Glad you like it.


Samah(Posted 2012) [#96]
Well it was enough to make me buy Sublime anyway. Once I fixed the path issues, iOS built flawlessly first shot. Given how fast it builds and deploys, it's much nicer being able to prototype in the iOS simulator rather than under HTML5.


matt(Posted 2012) [#97]
Hurrah!

These bundles took a lot of time so if you feel like throwing a beer my way there is a donation button on the download page.


Samah(Posted 2012) [#98]
I have heaps of cash in my PayPal account apparently, so ok. :)


matt(Posted 2012) [#99]
Thanks for the donations guys! :D


richo(Posted 2012) [#100]
When using the Sublime Text 2 Plug-In under Mountain Lion with XCode 4.4 - I was unsuccessful in adding to the environment $PATH variable as per instructions. If you're having this problem - this work-around might help!

1) Create a new file in Sublime Text 2
2) Cut and paste the following code into your new file:

import os
MONKEY = ':/Applications/Monkey/bin'
os.environ['PATH'] += MONKEY
print 'PATH = ' + os.environ['PATH']

3) Replace the path in the MONKEY variable above to match your own path to Monkey's bin directory
4) Save the file as MonkeyPath.py in the following directory:

~/Library/Application Support/Sublime Text 2/Packages/User/

5) Restart Sublime

Hopefully this helps someone out there ;-)


matt(Posted 2012) [#101]
Thanks. Where did you get this info? What's its background?


richo(Posted 2012) [#102]
I found some source online that created startup python scripts for Sublime Text 2 - I modified this source to suit the situation.


matt(Posted 2012) [#103]
Thanks


Halfdan(Posted 2012) [#104]
Thanks for the plugin
Would it be possible to auto capitalize keywords when typed like Ted?


matt(Posted 2012) [#105]
What is your use case?

Using the autocomplete menu, or Escape keyword picker, inserts CamelCase keywords for me.


Halfdan(Posted 2012) [#106]
I'm used to typing: "field value:int" (without auto complete), I'd like that te become "Field value:Int"

Maybe I should use autocomplete but I dont think Int/String/Float are in the keywords


matt(Posted 2012) [#107]
That would be a wider Sublime Text 2 issue, not specific to my bundle - as far as I know. Sorry I can't help you with any further info.


Muttley(Posted 2013) [#108]
@matt

The bundle only recognises long/verbose End statements, ie. End Class rather than End. Both are valid Monkey code. But the syntax parser seems to get confused sometimes with End If statements. The result is wrongly coloured End statements in the document after the rogue EndIf statement.


Having just done a sublime definition for BlitzMax, I've found the best way to handle this is to use something like the following for the regex matches:

(?i:end\\s*(?:function|method|type)?)


That way it will match all the following:

End
End Function
EndFunction
End Method
EndMethod
End Type
EndType
end
end function
endfunction
end method
endmethod
end type
endtype



matt(Posted 2013) [#109]
I have a number of very similar regex to do the End matches. But there's some quirk to the order that competing regex are run - which is rooted in the bundle being primarily for TextMate - which I've not had time to look into.

If you want to look into it and submit a pull request on github I'll happily merge it.


Muttley(Posted 2013) [#110]
Yeah, ordering can be critical. It's also best to ensure that any regexes are in most->least specific order too.

I'll try have a peak at some point.


matt(Posted 2013) [#111]
Cheers. And let me know where I can see your BlitzMax definition, thanks.


Muttley(Posted 2013) [#112]
Here ya go: https://bitbucket.org/muttley/syntaxdefinitions


matt(Posted 2013) [#113]
Cheers


Muttley(Posted 2013) [#114]
@matt: Just to let you know (in case you've not grabbed it yet), I've now moved it to a dedicated repository: https://bitbucket.org/muttley/sublimetext.blitzmax


matt(Posted 2013) [#115]
Thanks for the headsup


consty(Posted 2014) [#116]
Does this work on Sublime3?
Also I would like to know how can I install it (I use windows 8).


wiebow(Posted 2014) [#117]
[]


wiebow(Posted 2014) [#118]
Hi Matt,

I noticed that you do not support Linux as MonkeyX doesn't support Linux. Well, it does. :)
I also noticed that For ... End For loops are not recognized, but For ... Next loops are.
But, do you still support this? There have been a lot of new versions of Monkey since the last update of this bundle.


matt(Posted 2014) [#119]
I support it in as much as I will marge any pull requests I get on github.
And I will happily allow contributors to the code.
But I am not actively making changes myself at this time.


TheRedFox(Posted 2015) [#120]
Thanks for making it available. Works nicely.
Sublime Text 2 here.


s.smith(Posted 2016) [#121]
https://github.com/gingerbeardman/monkey.sublime
THX a lot, useful package. Have tried to use in Windows, build doesn't work ($Path was changed and in cmd command calls fine, but each time "File doesn't exist" happened in sublime). Have tried in Linux (Debian 8), works fine with a few changes.

Please, add for each target in *.sublime-build files :

"linux":
{
"cmd": ["transcc_linux", "-target=Desktop_Game_(Glfw3)", "-run", "\"$file\""]
}

NOTE. Valid targets: Desktop_Game_(Glfw2) Desktop_Game_(Glfw3) Html5_Game