Tutorial Tools of the Trade: Sublime Text v1.1

Discussion in 'Starbound Modding' started by The | Suit, Oct 6, 2015.

  1. The | Suit

    The | Suit Agent S. Forum Moderator


    The tools of the trade series is a small tutorial series dedicated to explaining various functionalities of specific tools to help you with starbound modding.
    This will help get you more quickly antiquated with important functions will result in making your life much easier when you dive through the files.

    The first Tool we will look at is Sublime Text

    Sublime Text is an extremely powerful text editor with a vast assortment of plugins and tools to make your life easier.
    Sublime text is essentially free as in Sublime text 2 is an evaluation ware with full features and no time limit.

    [ For Mac \ Windows \ Linux ]

    Lets take a look at some important features;

    Advanced File and Folder Search + Regex
    One of the beautiful features of this program is the ability to search for references across multiple files, in multiple folders extremely quickly.
    For those of you who are antiquated with computeres would know that control + f brings up a simple search in majority of applications. In sublime text control + shift + f will bring up an extended feature "Find in Files"


    In the "where" box you can choose multiple folders of where to search for the particular line of text, which is seperated by a comma with each full directory location.
    After which the program will search all files in those corresponding folders. You can also exclude certain folders by clicking on those 3 dots to get a bit more wide range of options.

    On the left side you may also notice 5 buttons
    • Regular Expression
    • Case Sensitive
    • Whole Word
    • Show context
    • Use Buffer

    I am only going to focus on one of the buttons which is Regular Expression (regex)
    Regex lets you search for a piece of information by not just searching purely on a string ( a set of letters numbers symbols etc ) but by creating an algorithm to look for a specific combination.

    For more information on Search feature as well as how to write regex compatible code ( for those interested ) see link below.

    Package Control
    Package Control isn't exactly a "feature" as it is really a separate plugin which lets you easily and quickly search online for and install \ uninstall \ enable and disable plugins.
    The downside though is you won't be able to garner any information of the plugins through the application. You will need to visit the actual site for that. Which is https://packagecontrol.io/.
    There are a few thousand plugins for sublime text which adds a horrendous amount of functionality to the program. From JSON lint interpreter right into the app to coloring formats, spacing and a slew of other things.
    Its good to spend a few minutes ( or hours ) checking out what it has to offer.

    In order to utilize package control you must install it manually first. This is simply done by first going to this site.

    Once installed and you have found a package you wish to add to your sublime. Simply go to
    Preferences --> Package control
    A new window will appear


    Type in install and hit enter.
    Then type in the name of the package you found on the website and hit enter and it will install.
    Simple as that.

    Recommended Packages:
    https://packagecontrol.io/packages/Starbound Lua
    • In bracket highlighter changing settings to content highlight bar = true, as well as not forgetting to change the syntax to JSON each time really makes your life a lot easier.

    Word Wrap
    Word wrap usually is not on by default. If you are generally used to a standard word editor the editor will wrap the text around for you when you reach the end of the page.
    But in notepad style apps this generally is not the case, as it will continue to go on to near infinity, unless you forcibly enter a new line by using enter.
    Word wrap will wrap the text when the screen ends.
    This setting is found in view --> word wrap.

    Syntax is essentially the "language" of the document. By setting the syntax the program will highlight specific functions \ variables \ and other nick nacks to make it easier to follow the code.
    In general Sublime text will automatically choose the proper syntax based on the extension of the file you opened.
    For example if you opened a file called stat.lua, it will automatically set the syntax to lua.
    When it comes to starbound files they generally simply use a descriptor extension. Or in another words an extension which serves no purpose then simply describing what that JSON code is suppose to represent.
    Which means you will have to manually set it to JSON if you want to utilize the syntax features.

    Image Without Syntax Highlighting


    Image with Syntax Highlighting


    This is done by going to;
    View --> Syntax --> Javascript --> JSON

    Bracket Highlighting
    One of the important things to know where a bracket ends and begins as in some cases you may end up either forgetting to close a bracket or even begin one. Some times you may inadvertently delete a bracket resulting in errors.
    In sublime by placing your cursor next to a bracket it will highlight the starting bracket and ending bracket.
    If you notice that it is pointing to the "wrong" bracket, chances are you made a mistake and you inadvertently missed adding the bracket or deleted it by accident. For sake of example;


    In the example image above you will notice the scripts square brackets and underlined. Indicating both the opening and closing when the cursor is placed next to the bracket.

    Sublime Text supports multiple tabs which lets you keep multiple documents open at the same time. But it also lets you create a column with the window to let you see multiple documents at the same time also.

    This is done by using the layout functionality at View --> Layout
    Which let you choose how many columns or rows you want. Then simply drag the open tab to the particular area, to visualize multiple documents at once.

    Last edited: Oct 9, 2015
  2. Mackinz

    Mackinz The Waste of Time

    Notepad++ works great too and is -entirely- free (unlike an endless trial run for Sublime). Does not seem to be much difference between the two, aside from very advanced users. Basically everything shown in this thread for Sublime has a counterpart in Notepad++.
  3. sayter

    sayter The Waste of Time

    Don't ignore this post, modders. You want Sublime Text. You simply don't know it yet. I've used it for years in professional work with webdev. It is , hands-down, the best option out there at present. Packages really give it extra weight, in that you can customize the hell out of it. It also helps reduce errors on your end visually before you even need to save a file and miss a key problem.

    Mackinz is right though, Notepad+ is also great. But I prefer sublime, because of all the little extras. The black background helps, too :)
  4. Mackinz

    Mackinz The Waste of Time

    Oh, and Notepad++ is only available for Windows. Sublime is cross-platform. If you work on Mac or Linux, get Sublime, but Windows users can use Notepad++ instead.
  5. sayter

    sayter The Waste of Time

    Or you could be crappy and use the default text editors of your OS...or *makes disgusted face* Word.
  6. The | Suit

    The | Suit Agent S. Forum Moderator

    I will be doing a notepad ++ also
    But sublime is far better - just because of the packages.

    For example Sublime Text has a package to add jsonlint directly into the app.
    So no need to go online to check if the code has mistakes.

    Not to forget UnkownX7 created a Starbound Lua syntax sheet for quickly going through Lua functions.
    Links found in the recommended packages in the post.

    You won't be able to use word since you have to manually set it to UTF-8 you will just get UTF-8 errors when you use special characters like double quotes.
    sayter likes this.
  7. sayter

    sayter The Waste of Time

    I know. I'm referring to people that know not what they do and try anyhow. Some people try it.
  8. The | Suit

    The | Suit Agent S. Forum Moderator

    If you have any recommendations of particular packages that would be great too.
    Also if you know how some good settings for bracket highlighter that owuld be great.

    Right now I use only line highlighter to get a rough idea of where it begins and ends.
    Similar to the default np++ feature.
  9. sayter

    sayter The Waste of Time

    Honestly, never used the bracket highlighter. Didn't know that was even a thing. I'll be using it now though!
  10. 1nfinitezer0

    1nfinitezer0 Cosmic Narwhal

    OSX user here. TextWrangler is my editor of choice, it's got the option to view any file as JSON syntax highlighting from a quick pop up menu at the bottom left which is nice.
    Although Macs generally have good search ability, it's finnicky that you must search from within the folder and choose only that folder to find files and info packaged within an application or the Library. An alternative for this is EasyFind, which is slower but super thorough. Apparently you can even validate JSON from within TextWrangler with custom python scripts.
    The | Suit likes this.
  11. Panthera Pardus

    Panthera Pardus Subatomic Cosmonaut

    Hello Everybody,

    I am using Sublime Text 2 with the Packages mentioned in the first Post. When I add a line with a comment (like this: // 025 ), it will be marked as an error.
    My Question: Is there a way to tell Sublime Text 2 to ignore these errors?

    Joy and Happiness
    Panthera Pardus
  12. The | Suit

    The | Suit Agent S. Forum Moderator

    If you use the JSON Parser comment tags aren't actually accepted in any parser.
  13. Panthera Pardus

    Panthera Pardus Subatomic Cosmonaut

    Hmm, ok. I had already suspected something like that, but I was not quite sure.
    Thank you for the Information, and this nice Tutorial. Have a nice Day/Night and

    Joy and Happiness
    Panthera Pardus
  14. bk3k

    bk3k Oxygen Tank

    Wine disagrees with you. Notepad++ can thus be used on Linux as your text editor. It is what I did when I was using Mint(because it is what I was used to). I assume the same is possible in OSX. Instructions are available(forgot where but Google could tell you) to help you set it up in a seamless fashion so that you can use it like any other option. I don't recall it being terribly difficult.

    Yeah they also had... was it notepadqq? Something like that that was inspired to be a native Linux notepad++ clone but to me it wasn't quite the same. However Notepad++ contained in Wine works beautifully enough that I just went that route.

    I am tempted to try Sublime text just because, but I may be too much a creature of habit to switch ultimately. Although having a second function rich editor could be useful for working on separate projects. I have so many files open at once often the tabs over-run me. I need something like Firefox's tab groups but for Notepad++. Having something specific to Starbound is also tempting.

    Notepad++ has a plugin downloader/manager that I'm fairly certain is the same idea. No need to go to a website/download/install. Do it within the program. So I don't know that Sublime wins here.

    BUT... what may separate them (this I don't know) is perhaps the quality of the packages/plugins themselves. Perhaps I may like something available in Sublime that doesn't have an equivalent in Notepad++? Or perhaps the equivalents aren't as good per personal tastes? Of course the opposite is possible too. I'm not apprised of Sublime's package choices. That sort of comparison would require me to be familiar with both program's packages/plugins, and still would be subject to personal tastes of course.

    But the most important thing to know is that Notepad++ has a plugin that's actually a tetris clone that you can play within it but kill quickly while otherwise keeping the same window up, so Ty doesn't know you're slacking. Even if you minimized instead of killing it, he'd only see Notepad++ on the task bar. Not suspicious at all.

    Yeah really late reply I know.

Share This Page