Renpy language support in Sublime Text
Forum rules
Do not post questions here!
This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Do not post questions here!
This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Renpy language support in Sublime Text
After seeing williamd1k0's Renpy atom plugin, I decided that Sublime Text was overdue for some Renpy support.
For those unfamiliar with Sublime Text, it's a text editor/IDE mostly aimed at professional programmers.
That's not to say that you need to be a programmer to use it. Even if you're just writing Renpy scripts, having things like syntax highlighting, autocomplete, distraction-free mode, etc. may be of use to you.
If you're curious, you can download ST and run the free trial indefinitely. (Unless you use it for work purposes, the license cost may seem a bit high)
Anyway, onto the package: https://github.com/koroshiya/Sublime-Renpy
You can also install it via Sublime Text's package control by looking for "RenpyLanguage".
This package adds syntax highlighting for most Renpy keywords and some classes/methods, as well as autocomplete for all of the methods I could find.
There are still improvements to be made, keywords to be added, etc.
For those unfamiliar with Sublime Text, it's a text editor/IDE mostly aimed at professional programmers.
That's not to say that you need to be a programmer to use it. Even if you're just writing Renpy scripts, having things like syntax highlighting, autocomplete, distraction-free mode, etc. may be of use to you.
If you're curious, you can download ST and run the free trial indefinitely. (Unless you use it for work purposes, the license cost may seem a bit high)
Anyway, onto the package: https://github.com/koroshiya/Sublime-Renpy
You can also install it via Sublime Text's package control by looking for "RenpyLanguage".
This package adds syntax highlighting for most Renpy keywords and some classes/methods, as well as autocomplete for all of the methods I could find.
There are still improvements to be made, keywords to be added, etc.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
- netravelr
- Miko-Class Veteran
- Posts: 504
- Joined: Thu Jan 28, 2010 2:31 am
- Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
- Projects: Love at the Laundromat
- Organization: Lakeview Interactive
- Deviantart: netravelr
- Location: USA
- Contact:
Re: Renpy language support in Sublime Text
Awesome! I actually do all of my RenPy programming in Sublime Text, so this'll make things even easier. Thanks!
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Renpy language support in Sublime Text
I have only used Editra for my Ren'py coding needs. It seems like it does whatever I'd need...but now you are telling me about Sublime Text.
So...could you tell me what the advantages of Sublime Text is over Editra? Why would a person want to switch over? Should I switch over? Thanks!
So...could you tell me what the advantages of Sublime Text is over Editra? Why would a person want to switch over? Should I switch over? Thanks!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Re: Renpy language support in Sublime Text
Woo, I knew I wasn't the only onenetravelr wrote:Awesome! I actually do all of my RenPy programming in Sublime Text, so this'll make things even easier. Thanks!
I'm unfamiliar with Editra, so I can't really compare the two, but some features people might find handy in ST with Renpy include:trooper6 wrote:I have only used Editra for my Ren'py coding needs. It seems like it does whatever I'd need...but now you are telling me about Sublime Text.
So...could you tell me what the advantages of Sublime Text is over Editra? Why would a person want to switch over? Should I switch over? Thanks!
-Syntax highlighting. eg. The "scene" keyword in a scene statement will appear red, dialog inside quotation marks will be yellow, etc. making it easy to see if you've forgotten the ending quotation mark, misspelled "scene", and so on.
-File-specific word completion. This is like spellcheck for Android or iOS, but the words are ones you've entered yourself.
For example, if I open chapter_01.rpy, and I write 1000 words, ST will have started to remember certain words that I've typed. If my main character's home town is named "Metropoliblahblah", ST will remember that word after I've typed it once or twice. So the next time I start to type in "Metro", it will realize I'm trying to enter the town's name and give me the option to automatically complete the rest of the word by pressing Tab.
-Character pairing. For example, if I enter a quotation mark, a second quotation mark will appear immediately after it, and my cursor will be placed right between the two. Combined with syntax highlighting, it becomes very hard to forget closing quotation marks.
-Auto indentation. eg. If you're in a label, and the line of text you've just written is indented by four spaces, then hitting enter and going to a new line will automatically indent you by four spaces, matching the previous line.
-Code completion. When typing a method name, you'll be shown potential matches. eg. If I type "me", ST will match that to Renpy's "menu" statement. If I hit Tab, ST will complete the method for me.
So "me" will become
Code: Select all
menu:
''
'Choice 1':
pass
'Choice 2':
pass
This works for any methods I've remembered to add. eg. "dis" will allow me to autocomplete
Code: Select all
Dissolve(time=, alpha=False, time_warp=None)
-Distraction-free mode. This is basically a fullscreen mode, optionally with tabs and the sidebar open. There's not a lot to explain for this one. It's just handy if you want to focus on the script at hand, or if you need more screen space.
There are plenty of other features to explore (eg. theme customization, multiple cursors, etc.), but I think the above would be most relevant to Renpy coders.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
Re: Renpy language support in Sublime Text
On top of that, Sublime is just pretty. Of course, it's also $70 for a license... although there's nothing stopping you from using it on trial mode forever.
I also didn't have much trouble scripting with just the python syntax, but thanks for this, definitely nicer.
I also didn't have much trouble scripting with just the python syntax, but thanks for this, definitely nicer.
- sendo
- Veteran
- Posts: 290
- Joined: Sun Sep 01, 2013 2:28 am
- Completed: To Libertad, Diamond Rose, SC2VN, Sickness VN
- Projects: eroges!
- itch: sendo
- Contact:
Re: Renpy language support in Sublime Text
So much this! Of course, having a pretty editor doesn't make you a better coder or anything, but it improves my workflow ^^philat wrote:Sublime is just pretty.
Here's what my Sublime workspace look like in distraction-free mode :3 (I added a couple more keywords btw) Aside from the features Zetsubou listed, I love the Goto Anything feature of Sublime. It basically allows you to find and open files by typing their filenames, instead of popping up a dialog box or navigating through a directory. You can also jump straight to class methods by typing <classfile>@<method>. Best of all, it uses fuzzy search so you don't have to type everything!
Thanks for this Zetsubou!
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Re: Renpy language support in Sublime Text
No problem
If you notice missing keywords or methods, by all means file an issue on GitHub (or send a pull request, or post here, or...)
If you notice missing keywords or methods, by all means file an issue on GitHub (or send a pull request, or post here, or...)
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Renpy language support in Sublime Text
I'm using Sublime Text for the first time and it's interesting.
I can't find, though, how to get auto-indentation after a colon. I have it in Editra.
Any help?
I can't find, though, how to get auto-indentation after a colon. I have it in Editra.
Any help?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Re: Renpy language support in Sublime Text
I'm afraid I haven't figured that out get, though it's something I'd really like to add.
At the moment it'll only do so for recognized python statements (if, else, etc.).
I've currently settled for auto-complete for things like menu statements, though if I do figure it out, or someone else does and sends me a pull request, I'll definitely add it.
At the moment it'll only do so for recognized python statements (if, else, etc.).
I've currently settled for auto-complete for things like menu statements, though if I do figure it out, or someone else does and sends me a pull request, I'll definitely add it.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Re: Renpy language support in Sublime Text
Okay, figured it out.
I've added auto-indent support for lines ending with a colon in v1.0.2.
It's been pushed to GitHub, so the update should be available through package control sooner or later.
I've added auto-indent support for lines ending with a colon in v1.0.2.
It's been pushed to GitHub, so the update should be available through package control sooner or later.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
Re: Renpy language support in Sublime Text
Hmm. I don't know that this is a bug per se, but auto-complete is kicking in more often than I want it to.
For instance, if I type show screen test and hit enter, it will automatically convert "test" into FileTakeScreenshot. There are a few other things like this. I haven't really poked into customizing Sublime Text behavior, but Zetsubou, do you know how to set it so it would only autofill/autocorrect if I press tab or something like that?
For instance, if I type show screen test and hit enter, it will automatically convert "test" into FileTakeScreenshot. There are a few other things like this. I haven't really poked into customizing Sublime Text behavior, but Zetsubou, do you know how to set it so it would only autofill/autocorrect if I press tab or something like that?
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Renpy language support in Sublime Text
@Zetsubou: Have you checked the link that renpytom gave in the Atom thread with the reserved words for keywords and properties?
https://github.com/renpy/renpy/blob/mas ... eywords.py
https://github.com/renpy/renpy/blob/mas ... eywords.py
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Zetsubou
- Miko-Class Veteran
- Posts: 522
- Joined: Wed Mar 05, 2014 1:00 am
- Completed: See my signature
- Github: koroshiya
- itch: zetsuboushita
- Contact:
Re: Renpy language support in Sublime Text
Yeah, having autocomplete on enter can be annoying. To make it only happen on tab, go to:philat wrote:Hmm. I don't know that this is a bug per se, but auto-complete is kicking in more often than I want it to.
For instance, if I type show screen test and hit enter, it will automatically convert "test" into FileTakeScreenshot. There are a few other things like this. I haven't really poked into customizing Sublime Text behavior, but Zetsubou, do you know how to set it so it would only autofill/autocorrect if I press tab or something like that?
Preferences -> Settings - User
In that file, add the setting: "auto_complete_commit_on_tab": true
That will make autocomplete only happen on tab, not enter.
Funnily enough, the description for this option in Settings - Default is:
"By default, auto complete will commit the current completion on enter. This setting can be used to make it complete on tab instead. Completing on tab is generally a superior option, as it removes ambiguity between committing the completion and inserting a newline."
So you certainly aren't the first person to find autocomplete on enter annoying.
Thanks xavimat, I'll take a look later this week. It should only take a second to integrate, though there seem to be some duplicate values in there, and I'll need to remove any that already exist in python.xavimat wrote:@Zetsubou: Have you checked the link that renpytom gave in the Atom thread with the reserved words for keywords and properties?
https://github.com/renpy/renpy/blob/mas ... eywords.py
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails
Working on:
Sable's Grimoire 2
https://zetsubou.games
Re: Renpy language support in Sublime Text
Thanks, Zetsubou! I like how they say auto complete on tab is superior, but the default is enter, haha.
- shivanshs9
- Regular
- Posts: 54
- Joined: Sun Jul 20, 2014 1:59 pm
- Projects: The Destiny(http://thedestiny-cxz.blogspot.com)
- Organization: Cyber-X-Zone
- Location: India
- Contact:
Re: Renpy language support in Sublime Text
Thanks! I've been using Sublime Text for years and was trying to add Ren'Py keywords in it for ease of work, but it was getting difficult, so I dropped it. Thanks again, Zetsubou, for your patience to add all the keywords in it!
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
Who is online
Users browsing this forum: No registered users