Sublime Text 3
Installation, Default Editor, Package Control, RenpyLanguage
Atom, a powerful text/code editor, has recently been added as an option in the Ren'Py Launcher. Quite the honor, given that the only other official option is jEdit, which... Is not the best, but I do have a soft spot for it. I admit it, jEdit was my first editor when I started working with Ren'Py.
Eventually, I did move on from jEdit, and joined one of the two big camps - I settled on Sublime Text 3. It does theoretically require a purchased license, however can be downloaded for free and has an unlimited trial period. There is a pop-up every now and then prompting you to buy the license, but there are no limitations if you haven't.
I'm confident that the majority of coders working in Ren'Py are using either Atom or Sublime. And since Atom seems to be getting more attention now, I figured I'd show you what the other one can do!
First of all, however, I want to point out that it's not because I want to convince you that Sublime is the greatest and you should be using it. I think what matters the most is that you're comfortable with the tools you're using. If you're happy with whatever editor you have now, it's perfectly fine for you to keep on using it.
Unless it's WordPad. For the love of all that is holy, do not use WordPad as your code editor.
Let's get to work. I split this tutorial into sections, so you can jump ahead if you feel like it. There are big titles which preceed every section. These sections are:
Disclaimer: I only have Windows, so this tutorial is made for Windows users only. Hopefully Linux and Mac users will be able to figure it out on their systems by themselves. Sorry!
System Installation
You can download Sublime on the official website. Click on your operating system, or get the portable version, which doesn't have to be installed. If you don't know whether you have 32 bit or 64 bit Windows, you can find it with the help of pages like this one.
Setting as System Default
After the installation, Sublime probably isn't set as your system editor yet. So let's do that.
Get yourselves a .rpy file. You can get it quite easily, for example:
- There are some in the Ren'Py folder, under the /tutorial/game/ directory.
- There are default ones in every created Ren'Py project.
- You can open up Notepad and save it (can even be an empty file) with the .rpy extension.
Now open it up with Sublime. This can be done by right-clicking the file and choosing "Open with"
This brings up a window that after choosing "Choose another app" will bring up another window, this time to let you find your newly installed Sublime application.
This is located wherever you've installed it, by default in C/:Program Files/Sublime Text 3. Choose sublime_text.exe. Done! Now, everytime you open .rpy files, it should open in the Sublime Text 3 app.
Setting as Ren'Py Default
Once we have it as the system default, let's set it as the default for Ren'Py.
First, open up the preferences in your Ren'Py Launcher, right below the giant Launch Project button.
Next, select the option under Text Editor: in the left column. This may already be System Editor, like on this image, or alternatively one of Atom, jEdit or None.
...And select the System Editor option.
And done! Now, whenever you want to open an .rpy file, it should open in Sublime, no matter whether you open it directly from a folder, or through the Ren'Py Launcher's little Edit File sector or the Navigate Script > Files section.
The Command Palette
Now that that's done, we can open up Sublime and start setting things up.
The Command Palette. You can get to it through the Tools tab > Command Palette, or you can also use the shortcut Ctrl + Shift + P. This is a tool that allows us to do most of the things in Sublime that you'd find under different tabs, but through text commands. Don't worry, you won't have to use it if you don't want to. But we'll need it for the moment.
Open it up, and type in Install Package Control.
Package Control is a system that lets us search for and download packages, adding new things to Sublime. These can be minor things like new color schemes or themes, but also really useful ones, like packages for debugging, for cleaning up code, for Git integration if you're into that, for adding new syntaxes Sublime can work with, and more.
If the installation through command pallete fails, try following the manual installation. Once you do install it, a quick notice should pop up.
I said that we can add new syntaxes. This is important because Sublime doesn't know Ren'Py by default. Since Ren'Py is written mostly in Python, using Python syntax does let you get away with some colors, but it's far from perfect.
(By the way, all the syntaxes can be selected in the very bottom right. Check out how many there are!)
But now that we have package control, we can search for packages.
Open up the Command Palette again, and type in the next command: Package Control: Install Package.
Once you've entered this command, another window will open up. Here, you can search for packages. Try searching around after we're done here, see if you find anything useful for yourselves!
Right now, what's important to us is the Ren'Py Language package.
And finally, once you hit execute the command, a new tab will open up. This one will let you know the installation has been successful, as well as the latest changes. It doesn't get updated much anymore, but the state that it's in currently is more than sufficient.
The last thing we need to do is set this syntax as the default for Ren'Py's .rpy files. Just like the after-installation message guides us, after we've opened a .rpy file, go through the View tab > Syntax > Open all with current extension as... > RenpyLanguage.
Now Sublime knows Ren'Py syntax! This means it will:
- Show our script in nice, organized colours
- Try to suggest Ren'Py functions and variables to us, possibly saving us time
- Watch the indentation for us
The last point is moderately underrated. When you open a file in Sublime, your tab key will insert tab characters by default. It is common to use spaces instead, and you'll have spaces in most of the code you find written by others. While using tabs isn't a problem, mixing tabs and spaces is, so RenpyLanguage tries to prevent it. If it fails, there's a menu to control indentation in the bottom right, under either Tabs or Spaces, depending on what you're using at the moment.
Final Words
I think that Sublime is great, and now you know how to get started in it.
There is one advantage that using Sublime gives you. The Monokai color scheme, which you can choose at the Preferences tab > Color scheme..., is the same one I'm using myself, and the same one I'm using for my tutorials here on the website. Hopefully being able to copy the code even more precisely can help you follow my tutorials even better than before!
Thank you for taking your time to read this, and thank you for supporting me.