155 comments

[ 5.6 ms ] story [ 218 ms ] thread
For those wondering, auto-complete is quite fast.

I've always avoided IDEs that offered this because they seemed to be terribly slow -- pleasantly surprised so far.

This is such a great editor. Each update adds things I really appreciate. (How did I ever live without indent guides?)

I've been working in XCode so much lately that I've gotten really used to this style of autocomplete, so this update is very welcome.

Yes—indent guides are pretty sweet.
What I really miss in all these fast small editors is the quick-jump features that actually analyze the code and let me do things like

1) Jump the the function/method definition (even if it's in a different file) when I press Ctrl and click on the function name. Eclipse does this.

2) Quick find of the function/method definition across the whole project. Eclipse does this as well (Ctrl + R).

I don't use Eclipse that much, because it's ridiculously slow, but it has cool features.

> Jump the the function/method definition

for scripting languages, define a function as concatenated string in eval(), how could you find the function definition, without actually run the script for once?

Even if you run the script once, what if there is a delete_file() function you accidently called?

So do we need to implement a sandboxed VM in order to find definition, theoretical perfectly speaking?

sure, theoretically speaking you can't figure out everything until runtime, however even with 'scripting language' code you can still get quite far with basic static analysis.
Or just don't offer click navigation on functions defined in eval(). Acceptable trade off.
That's such an edge case. I've never seen anybody defining functions in evals, especially as concatenated strings.
I've done it.

Use case involves a class wrapping python's xml-rpc stuff to talk to Drupal.

Drupal's xml-rpc interface is not the most pleasant thing to work with, as you have to pass in a session id and auth token on every request, and then all the "actual" parameters go in as an array.

My wrapper class would query the remote interface for available methods, and then dynamically generate, via eval, a function object that used a closure to store the sess/auth tokens, and that took a variable number of arguments to pass as the 3rd array argument to the function. The eval'd function object was then bound as a method to the connection object.

It also did a bit more magic, such as on error logging the arguments to a file. ALl in all it made writing web-service clients a lot more pleasant.

You can do this in emacs with etags and etags-select.el. ctags works with vim.
"ridiculously slow"? Well, it is slower than a small text editor, but after using Visual Studio for about a year, Eclipse seems blazingly fast to me.
AFAIK Komodo IDE (7.0 at least) has this feature and it is definitely faster than Eclipse, but it is infinitely more expensive.
I haven't tried Komodo since a year, but when I last tried it, it definitely feet like "Not my kind".

None of the normal (you come to expect) keybindings work. It was slow/sluggish.

At the time when I checked out (I have no reason to believe why it would be much different today) Wing seemed infinitely more awesome. - The ability to split screens, the amount of time the UI actions take. The F1 and F2 that provide more screen real estate felt far more interesting than Komodo, which almost felt the opposite. Komodo didn't have the deep Python integration like wing does. The goto definition etc are far more better in Wing.

For Ruby, I highly recommend RubyMine.
I think you are looking for the CodeIntel plugin. It takes a few minutes to index large projects, but after that, it's really fast and Alt + Click will take you to the definition of things. I switched completely from TextMate.

Take a look: https://github.com/Kronuz/SublimeCodeIntel

    Supports all the languages Komodo Editor supports for
    Code Intelligence (CIX, CodeIntel2):
    
    PHP, Python, RHTML, JavaScript, Smarty, Mason, Node.js,
    XBL, Tcl, HTML, HTML5, TemplateToolkit, XUL, Django, 
    Perl, Ruby, Python3.
Where's C? Where's C++? Where's Java? That's disappointing.
Is SublimeCodeIntel working well again/yet? I tried it a few months ago on Mac and it caused major slowdowns all throughout ST2 - even just typing text was slow when it's installed. I've heard other such reports on the forums, and a co-developer had the same problem last week.
I use it daily and have no issues on my machine with slowdowns or any trouble. SublimeCodeIntel + SublimeLinter + autocomplete are what made me switch to ST2 a couple months ago. Haven't touched TextMate or emacs since.
As soon as they have the code required to analyze your code, they aren't small, and as soon as they run that code they aren't fast. OTOH if that's the functionality you want, use eclipse, intellij (or a variant like RubyMine), and buy a beefy computer with an SSD. Eclipse isn't slow on my machine.

EDIT: Now that I look at your two requirements, that's not at all hard for a language like C or java. I recall having this in 1993 on the OS/2 version of SlickEdit. vim or emacs will handle this no problem. If you want a GUI, Visual SlickEdit will do it, and for a whole bunch of languages on every OS.

Number 2) is included in Sublime Text (same shortcut, too). And it's fuzzy!
No, that only lets you jump to files, not to functions/methods.
ST2 allow you to do it within the same file, but not outside of the file.
Actually, with SublimeCodeIntel, you can jump to any definition anywhere in your project.

Moreover, at least in Python (perhaps others?), you can jump to definitions in any included lib that aren't even part of your project's source code--e.g., import something from django & it'll jump you right to Django's source for any imported method, class, etc.

I really wish Emacs had smooth scrolling, indent guides and that Minimap. Those are some killer features that you can't just implement in Emacs' scripting language.

edit: minimap exists! (Obviously only in GUI Emacs)

Animated sub-line scrolling probably requires hacking the Emacs source. Indent guides might be possible just in elisp, but I don't know how good they would look.

> you can't just implement in Emacs' scripting language.

you can't implement minimap in CLI. It's a GUI concept.

(comment deleted)
You can add indent guides to Emacs. Look for the first result in google.
No doubt Sublime has all kinds of nice features, but to me the best thing is the aesthetics. It's simply a pleasure to work in this editor. Sometimes I just like to have it sit there on the second monitor, while I do something entirely different on the first one. :)
I'm confused, doesn't it already have auto-complete? Mine's been doing that for a while now. What's new about this?
Are you using the dev version? If so, then yes you've had that for a while now. It just made it into the beta now ...
Previously the auto-complete required you to press tab. Now it shows a list of possible completions as you type, from which you can select the correct one.
Was hoping for some sidebar love in the new theme (file and folder icons, renaming files in place), but the changes seem good so far.
My favorite feature (already added in an earlier development release, but now finally in the beta track): On OSX, if you are editing a file you don't have write access to and you want to save it, Sublime now asks for authentication than then saves the file.

This is very convenient and not having this was the reason for still having TextMate around.

Is there any way to do the same in Vim?

  :w !sudo tee %
And here's the little mode-specific map I use:

cmap w!! w !sudo tee % >/dev/null

That's one annoyance out of the way. Is there a decent way to work with remote files yet?

This is always the killer for me.

Try this out: http://wbond.net/sublime_packages/sftp I haven't used it, but I'll probably end up taking a look at it soon. Please report back if you end up using it.
Been using this package for some time now and can say that it's been great. It's super-fast, and is integral to my work flow.
I just use Transmit to mount remote file systems. Works like a charm.
OK, this isn't "decent". But: On a Mac, with a good connection to the remote machine, I've found the combination of

- ExpanDrive, which uses MacFUSE to mount remote volumes over SSH, but with lots of metadata caching smarts to make it fast and reliable

- My hacky remote textmate script, which gives you a "mate" command on the remote machine via ssh tunneling (https://github.com/jaylevitt/textmate_remote)

to work well with TextMate. I've been meaning to try it on ST2 but haven't yet; as long as ST2 doesn't do the horrible thing TextMate used to do and continuously rescan the project directory in a blocking thread, you'll be cool.

On OS X, I highly recommend Dripbox. It automatically SCP's files that change on your local filesystem to a remote location.

https://github.com/epall/dripbox

I use it every day, editing files locally in Sublime Text 2, and then cmd-tabbing to Terminal to run tests. It's fast enough that I never even think about the delay.

The great thing about ST2's autocompletion is that it is totally extensible, allowing you to hack your own completion routines.

I wrote an indexer for Objective-J code last year, that scans a set of folders (which can include the Cappuccino frameworks if you like) and creates a completion index of all the class names, methods, functions, etc. It was trivial to make an ST2 plugin that completes using that data.

The abilitity to write your own autocompletion plugins for the freaky/obscure kinds of files you use really rocks. Even without heavy-duty semantic analysis of the code, you can get 90% of the way there and it is really useful.

The main problem right now is that the UI is still too narrow. Voting this issue up could help get that fixed:

http://sublimetext.userecho.com/topic/85632-need-the-complet...

What would it take to get it to be as smart as, say, Intellisense?
Well, that would really take a lot of work, to make it good.

There's some commented-out logic in the 'official' Cappuccino plugin for ST, that takes into account the scope and then works backwards to try to figure out what type of object you are messaging.

https://github.com/aparajita/Cappuccino-Sublime

But I think the reason that's commented out is that it is easy to get some parts working, but to do it right you need to analyze the whole code base, with a real parser, be able to follow the map of import/include statements back to know what code elements are actually available in the current scope, etc etc. And that's a lot of work.

Still, there's a lot of value in doing a good job with a simpler kind of completion -- and it is way easier, as long as the editor is extensible to the extent that ST is.

The reason that I ask is that I feel I am getting stuck with C# simply due to the comfort of Intellisense. I have to find some way of replicating that experience with other languages...

I know other languages of course, but it just feels like a hassle to code without Intellisense these days :p

If you have dynamically typed languages in mind, give it a try without completion, you might be surprised - different paradigm depreciates completion quite a bit.
Indeed. When getting really funky with ruby's metaprogramming, completion isn't going to help you.
I totally agree with you; I think it is barbaric to code without smart autocompletion.

I think to eventually get there, though, we need open-source solutions to get as good as JetBrains, Microsoft, and Apple. Otherwise you get Apple's great (for Obj-C only) CodeSense, but you have to use their horrible, auto-corrupting, fucking disgrace of an IDE. Or to get RubyMine's absolutely unparalleled Ruby code introspection and completion, you have to use their gut-wrenchingly horrible Java monstrosity.

When the indexing and completion are decoupled from the editing environment, that's the magic sauce that will make the open source solutions fork and flourish, and good completion will finally be like toilet paper and hot water.

That's why I am really happy with editors ilk ST2 which provide good infrastructure to make things like SublimeCodeIntel possible.

I'm 37, I program a lot, and my finger joints are wearing out. Typing every single fucking character of code is insane.

I feel the same about using VS2010 without Resharper. It's barbaric and code quality suffers because cleaning requires manual work. This is why VS2010 Express is not an option.

I hope Jetbrains makes their own kick-ass C# coder-style environment. I don't care if it's Java and IntelliJ as the shell.

There are loads of things VS2010 does that I simply don't need, I just need Speed, Solutions, Projects, Building, Running, Debugging, Version Control and the things Resharper already does.

Cmon Jetbrains, you can do it!!! Please?

Anyone using this editor should install this plugin first:

http://wbond.net/sublime_packages/package_control

It's fantastic and gives you a simple in-editor way to add/remove other plugins, direct from their github repos, without needing to leave or restart the editor. It also automatically keeps them all up to date.

Once it's installed, you can just use the command palette (ctrl+shift+p) to install any of these plugins: http://wbond.net/sublime_packages/community, plus any others that you add via their github repo.

Totally agree, Sublime really comes together when using some plugins and with this plugin it really makes the process of installing / trying or using / updating and removing very simple.
I'd also recommend immediately installing SublimeCodeIntel and SublimeLinter. These plus autocomplete have made ST2 the best editor I've used in 10+ years. And the latest beta is even faster than before.
CodeIntel never fails to make ST2 crash for me. :(
I feel SublimeClang is a must have for C/C++/ObjC developers
This guy has to be on caffeine, modafinil, and love for his product. Incredible velocity here.
Is it... really just one guy doing the core dev work? (nonwithstanding plugins and so forth)
Yeah, it's one guy called Jon. He's been really responsive when I've talked to him.
That is amazing! I'm impressed....
> If you’re feeling adventurous, you may want to enable the auto_complete_commit_on_tab file setting: This will make tab accept the current completion, and enter operate as normal.

I've had this on for about a week now, and although it was initially very disorienting, it's very easy to get used to it. I'd certainly recommend it, since it allows you to add a new line even if a suggestion is there.

Is this just me but no-one seem to talk about it. How can I get the Sidebar to have a similar color scheme with my main theme? I like the default Monokai but the Sidebar is light. The Soda theme & Color Scheme was nice but the new UI improvement in the IDE is so good to sacrifice it for Soda.
Is this controlled by the color scheme itself? I'm running Solarized Dark, and the sidebar does have the same scheme as the editing window.
Yes, this is part of the Color Scheme that you used.
To change the sidebar color, you can go into the default Theme directory, find the new global theme file and update it manually. It's all JSON, so just search the file for "sidebar" and you should find the RGB string to play with.
Favourite Option: When you close the editor, it just shuts down, saving all your buffers and restoring them when you reload. That means you can close the app, reboot your computer, whatever, and the edits you've been making aren't lost, and you aren't bugged for filenames.

Definitely a 'why don't all apps work like this?' feature.

This is the default behavior of document based apps on OS X starting with Lion. For instance: TextEdit behaves this way.
Yeah, if you've been extensively using Lion for document editing, this may not seem like a big deal anymore, but in Sublime it works just as well on Windows too.
(comment deleted)
Only at HN will you find people gushing about a $50 text editor.

It's totally pathetic yet oddly endearing at the same time.

Actually, what's endearing (or outright cool) is that he has been able to create an editor good enough that people are willing to pay $50 for it. With lots of free alternatives and big players it isn't the easiest niche to break into. The fact that he's been able to do this primarily on his own makes it more impressive.
I agree; it's cool. TextMate never impressed me too much, but I bought it one day when the author casually mentioned on MacSB that his order numbers were simply sequential (so order number X meant that X licenses had been sold). I was curious.

My order number was something around 5000. So Odgaard had grossed $.25MM already. (At some point a couple years later I bought it again, and the order number was like 48000. It's no wonder he disappeared for years on end.)

ST2 seems to be on that same trajectory.

(And the grandparent comment is idiotic, of course; a truly good text editor repeatedly makes the news here just as a uniquely novel hammer would undoubtedly be a prominent theme on carpenternews.com.)

I spend about as much time using my text editor as I do my mattress, and no one looks funny at someone paying hundreds of dollars for one of those. The text editor took far longer to put together, too.
People also pay hundreds of dollars for text editors, if you include Microsoft Word among those.

Edit: and Microsoft IDEs

Just so you know, these features have been available for weeks now in the dev builds. They get updated almost every day sometimes, the developer is an absolute machine.

http://www.sublimetext.com/dev

New release looks great. One problem I have with ST2 is dragging tabs from one window to another window. The actual dragging of the tab works but if it's the last tab in the window and I remove it and put in another window, I'm left with a window with no tabs in it. Can this "empty" window automatically close please?
I'm torn between using a nice proprietary editor like this, or a fine open source one like Scribes, or even going further into the command line world like Vim.
Good software is worth paying for.

I hope the developer is able to live comfortably while working full time on his own endeavors, rather than relegate them to a hobby, and himself into wage slavery.

I can certainly agree with that.
Doesn't the new auto complete and the plug-in SublimeCodeIntel do the same thing? One of my concerns is that say you are using a plug-in for a feature that is later implemented into Sublime, now you haven't read the what's new so you have no idea. What happens then?
Not the same. The editor itself supports almost all file types with basic auto-completion. SublimeCodeIntel supports a few scripting languages with more intelligence. SublimeClang doing same smart job for C/C++/ObjC.

It's just based on your work pattern to decide which one to use. For me, all 3 of them are all very useful everyday.

If you use vim be sure to check out the Ex mode package: https://github.com/SublimeText/VintageEx
Vintage mode is a killer feature for people (like me) who are wired for Vim's modal editing. The fact that it works reasonably well (somes bugs here and there but it's an alpha so understandable) is what made me even consider Sublime in the first place.

Now, after having been using Vim for about 8 years now, after a few weeks of trying Sublime, I'm pretty much ready to pony up for SublimeText 2 whenever the final version is released.

Yeah, Vintage mode is really nice... but I just found this Ex package today as I didn't realize it existed. Without :s I was pretty lost in Sublime, but not now!
Using 'vip' to select the current paragraph didn't work for me on osx (instead it went into insert mode with the 'i'), so I gave up on my very brief trial. Did I give up too soon? Or is that oversight typical of other quirks I'll run into?
Could be a bug - I looked at the Vintage source when it was in alpha - they had implemented text objects for many delimiters but I also found some bugs with , for example 'ci{'.