Hello, world !
I've made a Sublime Text package to support and speed up PICO-8 development.
The package includes:
- .p8 language definition (by Overkill).
- Syntax highlighting (by Overkill).
- PICO-8 .ttf font (by RhythmLynx).
- Cartridge runner to launch your cart right from Sublime Text.
- Code completion based on the PICO-8 API.
- Code snippets.
If you have Package Control installed, just follow this instructions to get it:
- Open the command palette with "ctrl+shift+p" ("cmd+shift+p" in OSX).
- Run "Package Control: Install Package" command.
- Search for "PICO-8" and install it.
- Restart Sublime Text (if required).
Click here to see further installation instructions !
I will try to keep the package up to date along with the API CheatSheet and PICO-8.
If you installed it using Package Control, it'll update automagically !
Have fun.
I love that it uses both the font and the colors. Very cool.
Now I want a C64 Sublime package with similar features... hmm...
I noticed lineHighlight was identical to background in PICO-8.tmTheme. I made a local change (bumped RGB each up 16):
<key>lineHighlight</key> <string>#6F675F</string> |
and added to Syntax Specific - User settings:
{ "highlight_line": true, } |
to enable line highlighting. A slight divergence from the built-in editor but it makes up for an inability to match Pico-8's block cursor, which otherwise leaves the cursor difficult to see with these colors. (I tried several caret_style settings. If I missed something that would enable a more visible cursor I'd be interested to know.)
This is awesome! Reindenting lines does not work for me. Am I doing something wrong or is this just not implemented? I use reindenting all the time.
@Tilman it's a problem in the language definition that has so far evaded a solution
Really cool, thanks to the authors.
For 1.8 we need glyphs for the buttons. It looks like they're mapped to some unicode character, so the font just needs to supply characters for those codes. Also if we could get shift+udlrxo or alternative shortcuts to insert them in sublime too that would be great.
A token counter would be amazing for the LUA portion of the file. I'm not sure how feasible that is though.
New update !!!
v2016.6.30 changelog:
- added: command palette download font shortcut. - added: command palette preferences. - added: command palette bbs shortcut. - added: command palette API reference shortcut. - added: "highlight_line" setting defaults to true. - added: menu items to open preferences files. - changed: version system changed to tagging date. - changed: theme's line highlight is now a bit brighter than the background. - fixed: setup cartridge runner from the command palette. - fixed: run cartridges from the command palette. - removed: old build system. |
/me scoffs at the non-purists
;)
/me remembers not having done anything meaningful with PICO-8
:(
/me investigates Sublime
One question - is it necessary to download the font, i.e. is it a dependency? Because I've never enjoyed the PICO-8 font, and would rather not use it if in SublimeText
I'm having difficulty finding any links for the files you mentioned, even after going to: https://packagecontrol.io/packages/PICO-8
Could you please post a reply with all URL link downloads to this unique PICO editor.
Thanks !
@ibisum:
In Sublime Text, navigate to "Preferences > Package Settings > PICO-8 > Settings - User" or just open the command palette ("ctrl+shift+p" / "cmd+shift+p"), type "Preferences: PICO-8 - User" and add this line to the json:
"font_face": "<Comic Sans>" |
Just remember to replace "<Comic Sans>" with your desired font !
Of course, you can customise other Sublime Text settings for the language definition in the same json.
@dw817:
You only need to download the PICO-8.ttf by @RhythmLynx.
Here is the download link.
I've downloaded the font and the SUBLIME text editor. Thanks.
Don't I need something more than just the download of SUBLIME ? - like something to highlight commands specifically for PICO ?
And - how do I put the PICO font into the editor ?
@dw817:
Of course, you have to install PackageControl package manager first.
Here is the installation guide link.
The rest of the sublime-PICO-8 package installation is explained here.
About the font: with the sublime-PICO-8 package installed, Sublime automatically uses the PICO-8 font to render .p8 files if it is installed globally on your OS. Actually, what's happening in the background ? There's a Sublime preferences file unique to the sublime-PICO-8 package, and inside of it (it's a json file), there's a line like this:
"font_face": "PICO-8" |
You can override it by writting the same line with a different font declaration inside the package user preferences file, accesible the way I've already told to @ibisum in the last post.
Hope it helps !
[0x0] | |
Neko. I appreciate your help. One thing you'll find about me is I always write packages that are ready-to-run right out of the box.
You could possible say - oh, I don't know - maybe ZIP up all the elements needed for this new editor of yours in one big download so you don't have to download pieces of it from multiple sites.
Yeah, I think it's a good idea too. :)
There are fans and there are fanatics. I'm not a fanatic. While I appreciate the work done on this package, forgive me if I also offer some, hopefully, constructive criticism... and/or help to others like me.
One of the primary reasons for using a code editor such as Sublime is to bring some consistency to all languages and tools I work with. Therefor, to override that consistency kills one of the primary reasons for using Sublime. I have no need to punish myself with fonts and palettes like PICO-8's. (Even if I wanted to program in a 3x5 font, it would be Terminal 3pt and not Pico's horrible version -- I mean, ugh, that B is the worst rendition ever -- try writing DUMB and not reading it as DUNE. I will grant that Pico's N is better than Terminal's. Anyway....)
Thus, while I appreciate parts of this package, I do not appreciate that it overrides my font, color, tab, line padding, and line highlight settings (really?! forced line highlight? define the color but don't set the option). I wasted perhaps an hour or more finding the best way to reverse all this back to normal while not just simply uninstalling the package. [Try finding the default Sublime font if you don't happen to already know it. You can't find it in the Sublime prefs, you have to Google it.] Furthermore, you can't just revert to your own default Sublime settings if you follow the recommendation above to revert things by editing PICO-8 > Settings - User. That was a total waste of time. If you go that route then you have to come back here whenever you decide to change something that might be overridden here. Sometimes you may want that, but doubtful. No, expected behavior is far more achievable by going to PICO-8 > Settings - Default and whacking out most or all of the lines. Then you don't have to worry about storing personal settings in two places. Personal global settings stored in one place is ideal, right?
So, in other words, if someone wants to release a PICO-8 package without the default visual overrides, I would support it. If you then want to include an optional color scheme in that, fine. That's cool. If you want to also include instructions for setting the editor font for P8 files, that's also cool. I would find such a package much more helpful than this one.
Speaking of color schemes and such, you are missing Pico's alternate version with the dark blue background. See Pico's config.txt.
Also, another optional hint is to set "rulers": [32]
in PICO-8 > Settings - User. Note that if you then set the ruler through the menu system, you can't get this setting back until you close and re-open the file.
Another curiosity is that "no_antialias" doesn't seem to work on Windows (I believe you have to dig into Windows text settings to achieve this). So the replica text is close but not exact (but not a bother to me since I don't use it). UPDATE: the answer to this is to set both "gdi" and "no_antialias".
Some instruction on how to hook up Build (Ctrl+B) to launch the cartridge would also be helpful.
I apologize if this sounds too critical. I do appreciate and thank you for the work on this.
Matt
Here's another thing than can be done to make the Sublime experience better with pico. Install the Auto Fold package to code fold the header and tail data. To do this:
- Use Package Control (assuming you've installed Package Control) to search for and install Auto Fold.
- Use the Package Control:List Packages command to open a list of your installed packages.
- Click on the Auto Fold package to open File Explorer to the package location.
- Open
Auto Fold.sublime-package
as if it were a ZIP archive (it is) with something like 7-zip. (Or, follow the package instructions to find the following file on GitHub.) - Copy the
AutoFold.sublime-settings
file from the archive to the Packages\User folder in this same part of the tree. (For me this is: C:\Users\xxxx\AppData\Roaming\Sublime Text 3\Packages\User) - Edit and save that settings file to contain the lines I've added for pico (lines 16, 17, 26 -- don't forget to add commas to lines 15 and 25) as seen here:
{ "attributes" : [ // attributes to auto-fold "href", "src" ], "tags": [ // tags auto-fold "h1" ], // "\\{(.|\n)*?\\}" // note: multiline regexps should include \n. // "." does not mach new lines "regexps": [ // regexps to auto-fold "(?<=(url)\\().*?(?=\\))", // fold urls in css files "(?<=\\()http.*?(?=\\))", // fold markdown urls "(http://..)" "^pico(.*\n)*__lua__$", // PICO-8 header "^__gfx__(.*\n)*" // PICO-8 data block ], "extensions": [ // activate this plugin for file extensions: "html", "htm", "css", "xml", "md", "p8" ], "runOnLoad": true, // auto-fold on load "runOnSave": true // auto-fold on save } |
- Note that the Auto Fold package currently has a bug that causes it to not load until one of its triggering file types is opened after the initial startup of Sublime. That is, if you open Sublime with a P8 file already opened, it won't fold the code, not even on save. You need to either close the p8 and reopen it, or open another p8, html, or other supported file to trigger loading the package. Then the first p8 should fold on save. Thus, maybe keep a dummy html file nearby to workaround this. A bit of a pain but this package still looked more like what I wanted versus the other folding packages.
7.a. UPDATE: Auto Fold has been fixed to fold on most events including Sublime startup.
It might be worth considering borrowing (and fixing) the code from Auto Fold to include in this PICO-8 package.
Hi, I got the package and it seems to be working well except for the cart runner, I don't know if I set it up correctly or how to use it. I tried following from here https://packagecontrol.io/packages/PICO-8 hitting ctrl+shift+p entering PICO-8: Setup PICO-8 Path and I still get No Build System
and in both the default and user settings for the package I have the line
"pico-8_path": "C:\\Program Files (x86)\\PICO-8\\pico8.exe", |
not sure what I'm supposed to do to be able to run carts from sublime 3.
The plugin doesn't use the Sublime Text build system, JordanKlooster ! D:
Open the command palette (ctrl+shift+p) and search for "PICO-8: Run Cartridge".
Instead of changing the font size globally using Ctrl+= and Ctrl+Shift+=, I added
"font_size": 11 |
to the PICO-8 package settings and now the Pico-8 font stays fixed at its ideal scaling size while my normal font size elsewhere is a little smaller.
This is brilliant - only complaint is that the predictive text forces elseifs when typing if-else statements, the lack of linter and the lack of reindentation.
Any idea for workarounds on these 3 issues?
Brilliant packages btw - i'm sure it got a lot more people involved in pico8 development.
Hey, thanks !
Still, I can't run cartridges from sublime text, even with "PICO-8: Run Cartridge".
PICO launches, and says he could not load it.
Do you have an idea ?
I cannot get the run cartridge from sublime to work. I've done everything else and when I click the run cartridge nothing happens
This is interesting.
It makes me wonder if ZEP will if not allow for runtime to exceed 128x128 pixels, at least to have the editor optionally exceed this resolution for source-code editing and have and view lines longer than 32-characters.
Hoping someone can help.
I'm pressing CTRL+SHIFT+P and "PICO8:-Run Cartridge", pico8 opens but says "could not load" then the filename and path. I've saved source file as .p8 and saved it to a local drive.
Thanks in advance
I'm just now seeing a problem, may not affect anyone but me. When you RUN any cart, doesn't it bring up the P8 logo and audio riff each time ? Is there a way to bypass this ?
@dw817 I can't get carts running says could not load any tips?
You're asking a guy with a problem about another problem who can't solve your problem because his problem can't answer your problem until his problem is no longer a problem.
I think we have a problem ...
I too, am having issues running setting up cart runner. Looking for solutions!
Fixed some of the sublime - pico loading problems
I had issues to running a pico card from sublime, too. Here are some things I have figured out to make it work for me. Hope it helps.
I had to save the *.p8 file I wrote in sublime in exact the same location the pico demo folder is. For me this is:
C:\Users\User\AppData\Roaming\pico-8\carts\NameOfMyNewFile.p8
Note, the ending .p8 is importend.
Also, I figured out I have to inclued these folloing 3 lines as my first lines in the sublime written pico file: (dont worry, it doesnt count to the token count in pico)
pico-8 cartridge // http://www.pico-8.com
version 30
lua
here I can begin to write my game and the run cartridge function works.
(the format kills the underscores around the lua in the third line. There are two underscores in front of the lua and another two underscores behind. Try to make a picture of the three lines for you)
Hello all, I'm new here. Is there an easy way to just have Sublime Text 3 run the cartridge, without changing font or colors or with any kind of autocomplete etc, literally just like you're viewing any text doc in Sublime - but hitting a certain key launches the cart in Pico-8?
Awesome as it looks, I don't really need that stuff. POSSIBLY just the colors but can figure that out separately.
Thanks for any help.
Hi, newbie here to both coding and PICO-8 (and Sublime).
Is there a way to bind a keyboard shortcut to the "PICO-8: Run Cartridge" command?
Thanks
What Diablothe2nd said! I tried looking at key binding, but failed to work out how to reference the command "Run Cartridge"
did a quick web search and it seems that sublime text does not support configuring custom shortcuts! weird
I've been trying out Sublime again and I feel like, if I'm using the PICO-8 font to edit .p8 files, it should probably mimic the uppercase/lowercase reversal that PICO-8 has.
The original download links for @RhythmLynx's custom PICO-8 fonts are dead, so I tracked down an archived version of the alternate font with upper/lower swapped, and I'm posting it here in case anyone else wants to use it:
You'll need to set this in Sublime by clicking the menu option Preferences → Settings - Syntax Specific and editing the user settings in PICO-8.sublime-settings to look something like mine, notably the font_face line:
// These settings override both User and Default settings for the PICO-8 syntax { // my personal preference inside PICO-8 "tab_size": 2, // I have visible tabs; I can wrangle them myself "translate_tabs_to_spaces": false, // swao upper and lower to match PICO-8 "font_face": "PICO-8 mono reversed", // on my system, this makes gaps between lines one "pixel" tall, but YMMV with DPI "line_padding_bottom": 3, "line_padding_top": 3, // I don't think having this true by default was a good idea "pico-8_auto_lowercase": false } |
Ok, I'm really new/stupid here, but I've been using Sublime with the PICO-8 package for a while, and recently have had an issue not wanting to auto lowercase on save. I found this page talking about it, with a solution:
https://github.com/wh0am1-dev/sublime-PICO-8/issues/8
And I see @Felice has the same line in settings. However, when I put that line in PICO-8.sublime-settings (either/both Default and User), it seems to have no effect. What am I doing wrong?
[Please log in to post a comment]