News

Sublime Text 1.2 Now Available

June 21, 2009 by Jon Skinner

After many months of development, I'm very pleased to announce the release of Sublime Text 1.2. This is the most significant upgrade of Sublime Text since the initial release, and it's free for all registered users. If you haven't purchased a license yet, you can download a fully functional evaluation version.

New features in version 1.2 include a revised user interface, a project system, and support for TextMate format snippets, many of which are installed by default. In addition to this, it's more customisable, has an enhanced Python API, and improved facilities for day to day text editing.



Selecting a file in the project

Changelog Highlights

  • New project system
  • Updated user interface look and feel
  • Support for TextMate format snippets
  • Resizeable panes and panels in the GUI
  • Distraction free editing mode
  • Quick panel, to select between open buffers, file in the current directory, or files in the project.
  • Visible whitespace
  • Overwrite mode
  • Load and save files in various european encodings
  • New preferences menu
  • Swap lines command
  • Improved auto complete
  • Improved bracket matching
  • Improved auto pairing of brackets and quotes
  • Improved bookmark support
  • Close buttons per-tab by default
  • Minimap and scrollbars may be disabled in full screen mode
  • Assign names to buffers
  • API: Exposed auto complete functionality
  • API: Exposed findAll
  • API: Exposed quick panel
  • API: Exposed the input panel
  • Download it now, and try it out!

    Choosing an Extension Language

    April 12, 2008 by Jon Skinner

    If you're building an application, then your users will get much more out of it if you given them a plugin API. For Sublime Text, I settled on Python as the extension language. In fact, I think you'd be mad to choose anything else.

    For a desktop application looking for an extension language, the two most important things to optimize for are the likelihood that your users will create plugins, and the chance they'll actually enjoy it. This gives a few guidelines when choosing an extension language:

    • Adoption matters. There should be a reasonable chance that users already know the language, or if they don't, learning it is at least a worthy investment.
    • Unicode matters. How much depends on the application, but if users can't even write a script that opens a file in their home directory because of Unicode issues, you won't be winning any friends.
    • Libraries matter. File access, date / time, socket programming, subprocesses, etc. If you're writing a general purpose desktop application, then most plugins your users will want to write will involve using APIs other that what you've explicitly exposed.
    • Ease matters. Any language requiring a separate compilation step isn't a contender.

    There are also several criteria that don't matter for a typical desktop application extension language:

    • If you're going to depend on the scripting language having fast runtime performance, then Python may well not be for you: Lua or Scheme are both typically much faster, and have a lower memory footprint.
    • If you're depending on the language for security, such as a web browser running untrusted code, or a server running code submitted by users, then you have an entirely different set of considerations.
    • If the application is only going to be used in house, then it doesn't matter terribly much what percentage of users are familiar with the language, because they're going to be forced to use it anyway.

    At first glance, it appears that desktop application developers are spoiled for choice of extension languages, but caveat programmer:

    Scheme, despite having reasonable libraries and Unicode support, is far from mainstream. Using Scheme or another Lisp dialect as an extension language is an effective way to make sure you won't have any extensions. Early versions of Sublime Text used Scheme as an extension language, but it was dropped for this reason. Just because you like a language, doesn't mean your users will.

    Lua is another candidate, which has a lot of uptake in games. It has a very small code footprint, and excellent runtime speed. However, its paucity of libraries, weak Unicode support, and small-medium user base make it hard to justify as an extension language for desktop applications.

    What about JavaScript? It's an underrated, elegant language, with a huge number of people acquainted with its syntax. Its weakness is that it's not used as a general purpose language, so there's no selection of libraries your users will be able to build on. No libraries and no built-in standard APIs (file system access, I'm looking at you) rule JavaScript out.

    We come to Python and Ruby. Which language is better really isn't relevant, both are fine languages with pleasant syntax and semantics. In terms of ecosystems, both are popular and have a good selection of libraries. Python, however, is the bigger gorilla, with a larger user base and more libraries.

    Python, however, has a secret weapon: Python has ctypes, and Ruby doesn't (1). ctypes provides an ad-hoc way to call functions in any shared library in the system. This means that the platform's entire native API is available with no C extensions required. Take, for example, a user who wants to launch another application, then set the input focus back to yours. With Python and ctypes on Windows, it's only a few lines of code to call GetForegroundWindow and SetForegroundWindow. That's pretty awesome.

    Summary: Your users will be happiest if you choose Python. It's pretty hard to argue with that.

    1. Not strictly true, as pointed out in the comments, Ruby has a similar library called Ruby/DL 2. That's pretty cool.

    Python as an extension language: Not all beer and sunshine

    April 8, 2008 by Jon Skinner

    If you're shopping around for an extension language for your project, it's pretty hard to go past Python. Aside from being a very pleasant language to work with, it has a huge selection of libraries, and a user base that's at least as large. Add projects like Boost.Python into that, and you've got a pretty compelling case. However, it's not all beer and sunshine in Python land - at least, not on Windows.

    Lets start with the simplest case: Ship python25.dll, and python25.zip (containing the standard libraries) with your application, and provide some means for users to enter Python code.

    Golden, right? Not so much. It'll work fine right up until someone with an international version of Windows tries to install your application to a localized version of "C:\Program Files" that contains a unicode character. Then everything falls over.

    Oh, you thought Python supported unicode? Well, it does. Sort of. Provided you don't expect to be able to put unicode paths within sys.path, the list of directories python files may be loaded from. Ouch!

    There are still options though: you can set sys.path to load from the current directory, and just set the current directory appropriately before making any calls into Python.

    Now, let's take a look at loading user supplied plugins from .py files. You could just place them in the same directory that the application is installed to, but that's not a great solution on Vista, as users generally won't have write access to Program Files. A better location is to place them within the Application Data folder, contained within the user's home directory.

    This raises some more problems: It's not uncommon for users to have unicode characters in their username, and hence in their Application Data path. So we can't simply add that to sys.path. We also can't use the current directory trick any longer, as there are now two directories to load things from.

    For Sublime Text, I've implemented a half way solution: Do some sys.path_hooks mangling to get modules loading from python25.zip, and use the current directory trick for user supplied modules (Drop me an email if you're interested in the code). It's not pretty, but it does work.

    Aside from current directory wrangling, there's another option I've yet to try: short path names. Windows has a notion of short path names, where every file has its full path name, and a short one (see GetShortPathName) in 8.3 format for archaic programs. The noteworthy part is that the 8.3 name uses ASCII characters, so they'll be safe to use as Python module paths. There are a few caveats with this approach:

    • Not every file has a short path name. Generation of them may be turned off.
    • Some file systems don't support 8.3 file names: They presumably won't exist on Samba shares, for instance.

    It's unfortunate that Python has this limitation. My understanding is that it is not going to be fixed for Python 3.0, though there has been some work in this direction. Despite this, I still think you'd be mad to use anything else as an extension language.

    Distraction Free Editing

    April 4, 2008 by Jon Skinner

    Sometimes, you just want to focus on what you're writing. You don't need toolbars, you don't need tabs, hell, you don't even need menus. Using full screen mode in a standard text editor is a good start, but it's generally not as minimalist as it could be, and the text is all bunched over on one side of the screen.

    So what options do you have? If you're on a Mac, you can use WriteRoom, and which has a Windows clone called Dark Room. Other options are PyRoom, JDarkRoom and Vroom. These are all great for editing prose, but none support editing LaTeX, let alone code.

    If, like Mark Pilgrim, all this makes you wonder why someone would want a text editor with no features, then I do suggest giving one of them a try, it's a pleasant experience.

    Prompted by a suggestion on the forums, the current beta supports this very style. In this setup, there's nothing at all on the screen but your text in the center, and a muted scrollbar on the right. The cursor doesn't even blink. You can think of it as WriteRoom for Windows, with regular expressions, Python plugins and code editing.

    Here's a screen shot of it in action:

    Extra full screen thumbnail

    Note the lack of menu, status bar, toolbar, line numbers, rulers etc.

    Unlike multi pane editing, the objective here isn't to fit as much information as possible on the screen, but to block out everything that you don't need right now. It also works seamlessly with multiple monitors, with each one able to edit a different file in a similar fashion.

    [Edit: this is included by default in the latest versions of Sublime Text. Press Shift+F11 to try it out for yourself]

    Enjoy!

    PS., If you're writing the next great literary work, then you may also be interested in the very handy Automatic Backups plugin.

    PPS., Did I mention Sublime Text has LaTeX syntax highlighting out of the box?

    1.03 and Forums

    March 20, 2008 by Jon Skinner

    1.03 has just been released, featuring among other things, support for TextMate syntax files. Because of this, many more file types are supported out of the box. The default color scheme has been changed too - enjoy the delicious colors of Monokai. What are you waiting for? Download!

    Coinciding with this release, the much requested forum is up now too. Drop by and say hi!

    ClearType and Documentation

    January 22, 2008 by Jon Skinner

    The enthusiasm, support and feedback from 1.0 has been remarkable - thanks everyone! Work is progressing on the next version, you can view the current incarnation on the beta page. Notably, the beta has ClearType support, which has been one of the most heavily requested features.

    The first part of the documentation is up too, detailing how Selection works. It's available via the Support page. More to come!

    1.0!

    January 18, 2008 by Jon Skinner

    1.0 is out! Download it and take it for a spin, feedback is more than welcome!

    Like any bit of software, it's a long road to release, though in truth it's only the beginning. There's already a long list of features to add, and it's only going to get longer with your feedback.

    As feedback comes in, the feature list is going to get re-prioritised and added to, so the sooner you give it a try, the better chance you have of seeing your wish list come true!

    Regex Syntax Highlighting

    December 28, 2007 by Jon Skinner

    (Just a short post while I get the next one ready)

    Sometimes its the little things that make the difference. When you're entering a regular expression, you get syntax highlighting in the text box:

    You can see in the bottom of the screenshot, the regex operators and character classes are rendered nicely.

    Anatomy of a Next Generation Text Editor

    November 30, 2007 by Jon Skinner

    (This is an introduction to the user interface of Sublime Text, it's the first in a series)

    My background is in building tools for games. I've encountered some beautifully designed tools for artists, such as Modo, ArtRage and Silo. At the time I was using Vim in its 16 colour, 80 column glory, and the very colourful Visual Studio. It occurred to me: why couldn't the humble text editor get some of this love?

    I've tried to put some of this user interface craftsmanship into Sublime Text. There are three principles I felt would be required:

    • Unobtrusive, minimal chrome. The focus should be on the text, not fourteen different toolbars.
    • Don't obscure the text with dialogs.
    • Use the pixels you've got. Full screen, multi monitor and editing files side by side should all be possible.

    Below is a short tour showing how I've applied these rules in building Sublime Text. First, here's the basic day-to-day level of chrome you are presented with:

    There's not much there, and it's certainly not yelling at you.

    Functionality like find and replace, that would generally be implemented via dialogs, is instead presented as a panel at the bottom of the screen.

    The crown jewel, however, is how it works when you start to get serious. The full screen mode does away with a maximum amount of chrome, and works seamlessly with multiple monitor setups. Here you can see Sublime Text running on two monitors, full screen on each, with five files being edited side-by side.

    Here's a screenshot of the large monitor in the above photo, editing three files side by side in full screen. (Warning: 2560x1600 pixels ahead!)

    Have I missed any principles? Have I adhered to the ones I set? I'd love your thoughts and feedback.

    (Subscribe to the blog, so you don't miss part two!)

    Building a Better Text Editor

    November 30, 2007 by Jon Skinner

    The text editor is a humble tool, its purpose distinct and implementation well trodden. There are a lot of people who spend a lot of time working them them: you've probably got one open right now.

    I think they can be better.

    Furthermore, I've got a fairly strong vision of exactly how they can be better. I left my job as a software engineer at Google to build a company, and a text editor, around this conviction.

    I'd like to share my ideas for a better text editor; you'll shortly see the beginning of a series of articles describing just that. Stay tuned!

    In the mean time, why not let me know what you think a better text editor should be?