Hacker News new | past | comments | ask | show | jobs | submit login
Sublime Text 2 (Build 2111) gets vi key bindings, indent guides (sublimetext.com)
135 points by nikuda on Aug 31, 2011 | hide | past | favorite | 87 comments



Jon (jskinner) has been doing a great job of continuous releases with a mix of new features and bug fixes. It is easily the best $60 I've ever spent on an editor or IDE.

If you haven’t tried Sublime Text 2 before, I recommend taking it for a whirl. Most developers I've shown it to really like it. Here are some reasons it won me over:

Multiple selections. Select a variable and then press Ctrl+d/Cmd+d a few times. Now type a new variable name. Or, select a few lines and press Ctrl+Shift+l/Cmd+Shift+l. You can now make batch edits to all lines

Goto Anything (Ctrl+p or Cmd+p). Start typing a filename. Type an @ and then start typing a function or method name. Hit escape instead of enter to return to where you were.

It also has a very nice Python API that makes writing plugins fun. http://www.sublimetext.com/docs/2/api_reference.html

There are so many other little things done right that you find once you start digging in.


Some more:

If you have indentation set to use spaces, you can hit tab and it will add 4 spaces, then hit backspace and it will delete all 4 spaces. Most text editors won't do that.

It matches parentheses and braces, but you can just ignore it. Type a '(' followed by a ')'. With every other graphical editor I've tried that has brace matching, you end up with '())'. With sublime, you end up with '()'.


Fyi, the Eclipse does bracket matching as well. In fact, I think Sublime Text borrows the concept partially from Eclipse. [1]

Eclipse is slightly if I remember correctly, since it lets you skip all closed braces with a tab. That way, typing (([tab] gives you (())_ , where _ is the cursor. Very convenient.

[1] I don't remember the details, but I remember that I posted a few lines to the Sublime Text forum, that fixed part of the way bracket matching worked to make it more like Eclipse. This was later put into Sublime Text proper. This is what I love - Jon actually looks at the things people are doing, and puts the good stuff directly into ST.


Couple of features I wish ST2 had:

1) Ability to rename files and tell that to git/any revision control while it does it.

2) Bundler integration to automatically add all bundles to the project so they can be searched on.


I wish it had code folding, and I wish I could do a block cursor instead of the | (easier to see) but I don't think those are hugely popular requests.


Last I've seen, code folding has been requested from day 1. And I see requests / lamentations / mentions of it every time discussions about it crop up, without exception.

Personally, as shiny as the scroll-preview is, the fact that it doesn't show the structure of the entire document makes it almost worthless to me. As much as I hate visual studio, MetalScroll[1] was fantastic. You can see functions by shape, visually navigate the entire file at a glance (though I have good visual memory, so that may be easier for me), and it shows folds, breakpoints, changed lines, and selections. ST2 shows... about a screen in either direction.

[1] http://code.google.com/p/metalscroll/


I would like to second this sentiment. That feature has become a vital part of how I navigate code, especially for projects that I am looking at for the first time.

It's the only thing preventing me from using SublimeText 2.


SublimeText's minimap is not as feature rich as metal scroll, but its pretty useful in general as a nav tool. I often find myself wishing Chrome had a scrollable minimap.


The userecho page on Code Folding has a lot of votes, though there's some speculation that it'd be pretty difficult to do with the current implementation of the editor control.

http://sublimetext.userecho.com/topic/19281-syntax-code-fold...


If you do #1, you might as well throw in more commands. I can see why the author might not want to cascade in to that just yet.


I've moved from TextMate to Sublime Text 2 over the past few weeks. The only thing I miss from TM is the ability to jump back to the last opened file with command-t.

Has anyone managed to hack their config to enable that feature? I understand there are some callbacks available that might help, but I haven't figured out how to put them into action.


Ctrl+Tab and Ctrl+Shift+Tab navigate through the "stack" of recently opened views (files). Is this what you mean?


That only cycles between currently open tabs, so that's not quite the same. The genius of TextMate's go-to-file pane was that before you started typing, it would list your recently closed files, so the go-to-file pane had two functions in one, both servicing the need to open something that is not currently open.


That sounds like a mix of switching recent tabs and Goto File (ctrl+p/cmd+p).


Have you tried the "show files" panel? Ctrl/cmd-T. Works like TextMate's. Works like ctrl/cmd-P except it only accepts files, and will show a default file list when it opens.


Well, that was my original point above – the difference between cmd-T in TextMate vs. Sublime Text 2 is that TextMate ordered the files with the most recently opened at the top.

In TextMate, I got used to using cmd-t to jump back and forth between files. Minor thing, really. I just wondered if anyone hacked that same behavior into Sublime Text.


I missed that somehow, although it seems perfectly obvious now. I'm flexible enough to relearn a familiar key binding. (How often do you hear that in reference to a text editor?!)

Thanks!


Wish it could be hacked, but while you _can_ create search panels like that, you can't access the list of recently opened documents, as far as I've found.


Sublime Text 1 had a plugin that gave a Most Recently Used shortcut to open recently closed documents. It used the file-opening hook, recording ever file to an sqlite DB.


I also like it so much I wish he would go meta and tell us about the initial (winning) choices he made for developing ST2.


What I love about ST2 is that although it's very data-driven in configuration (several hierarchies of plain text configuration files + a simple python API), it somehow doesn't seem overwhelming, or that I'm missing all the cool tricks. I hope the author continues to comment all the configuration files and will document 100% of the API.

The editor itself has a great fluid feel. Looks-wise, the default theme is nice, and "Soda Dark", which seems to be a community favourite, is gorgeous.


Have they sorted out the rubbish file manager yet? When I open a directory I don't need an animation of the contents sliding in from the right. This slows me down. I want to switch to ST2 but there's just too many little things holding me back.


Okay maybe rubbish was a bit of an exaggeration but it's lacking in a lot of areas:

- No icons. Makes it hard to differentiate between files and directories at a glance. - No drag and drop, you cant quickly copy and move files. - Renaming files is clunky (on OS X at least). - Right clicking a file doesn't give you many useful options. - Doesn't match the host OS's file manager very well. It's some sort of weird middle ground; on Windows it should act like Explorer, on OS X it should use the same conventions as Finder.

Compare the file manager to the ones in Coda and Espresso and it's fairly poor. I know the ctrl/cmd + p shortcut is pretty amazing but sometimes you don't know exactly what you're looking for and have to fall back to browsing through a codebase to find what you're after.

This post sounds a bit hateful, but I really like the rest of ST2. It's just the file manager which gives me grief.


The fly-in animation drives me insane. I feel ridiculous that such a little thing bothers me so much, but every time I've tried to switch from Textmate to ST2 I've gotten hung up on those little details. They hurt my brain, and when I'm using a text editor I want to be 100% focused on my code.


I agree that that horizontal slide effect should go, it's just not an appropriate place for it.


How does one animation make the whole file manager "rubbish"? Seems a bit exaggerated...


What file manager? I just use Ctrl+P all the time.


Now that I finally found out about remember_open_files, Sublime might grow into a viable TextMate alternative.

I had real trouble finally finding a reference of the configuration settings. The official documentation on version 2 on sublimetext.com is still in its very beginnings and it wasn't clear to me that sublimetext.info is actually valid documentation for version 2.

As a hint: Maybe add a comment to the global configuration file poiting to http://sublimetext.info/docs/en/reference/settings.html for a list of possible settings plus a note to add the settings to the user configuration file.

On a related note, the reason I want to turn off remember_open_files is because for me Sublime is not the editor I'm doing most of my project work in (I'm using IDEA with Rails and PHP plugins), so Sublime (or currently TextMate) is just something I use for quickly opening a few specific files on the command line or from finder.

Seeing all the old files open alongside the current one is just distracting, so I really need it to forget about previous incarnations.


Sublime Text is a great editor. As a sometime vi guy, this makes me super happy.


ST2 is brilliant. If you're used to TextMate, I encourage you to give it a whirl. I think the trial version is an "unlimited" trial. It only nags you with a dialog box once in a while.


You should still buy it though. The authors made a great product and deserve to be compensated well for their work.


I second that.


Indeed. I never meant to say you should use the unlimited trial forever.


If you're a Vim user and like the idea of indent guides, check out https://github.com/nathanaelkane/vim-indent-guides


Interesting. A similar feature built into Vim is `cursorcolumn`, which will highlight the background of whatever column the cursor is in. If you set `cursorline` as well, you get a kind of cross-hairs around the cursor. See e.g. http://briancarper.net/vim/cursorcol.png

I find that feature useful enough that I've never needed indent guides. If you jump the cursor to the beginning of a line, you can easily see which other lines are indented equally with that line.


I've been using sublime text 2 for a month or so now and I am starting to become a big fan. I think that I'll purchase it soon. My requests...

1) Add all of the menu commands to the list of commands that show up when you press cmd-shift-p. It is very weird that some of the named commands (like convert to spaces) are available via cmd-shift-p, but others (like switch to 1 column view) are not.

2) I prefer the way textmate does multiple selection, where you can press a single key to toggle between regular selection mode and block selection mode.

Using cmd-shift-up/down in sublime text is very unpredictable. It works fine in the case you have several consecutive lines with no extra newlines in-between, but that is about it.

Though cmd-d to multi-select the next same word is pretty awesome.

3) Easier navigation between tabs in differnt split columns. I never remember the keys to switch between columns and I feel the existing normal tab management keys could do the job with a couple of tweaks.

For example, cmd-t is awesome, but I wish it was smart enough to automatically switch to an existing tab instead of opening a new tab with the same file in it.

Also, make cmd-shift-{ and cmd-shift-} move across all tabs and not just the tabs inside the currently selected column.

4) And lastly, the find in project results desperately need syntax coloring. It is so hard to scan a giant blob of plain white text.

Ackmate style file types would be nice too, but that isn't to big of a deal.

Again, awesome stuff. I can't wait to try out the vim bindings and I hope he keeps up the good work!


So looks like I need to give Sublime Text another shot.

I switched from ST1 to vim after almost a year of using ST2 exclusively for work. I very, very highly recommend you try Sublime Text out - I've used many editors, and Sublime Text is still, for me, almost the perfect mix of must-have features and ease of use. Alas, vim's amazing power was a little too much of a draw.

And if you try out Sublime Text, don't forget to check out it's killer feature (which doesn't have): Multiple Selections. They're the single most powerful non-obvious editor feature I've ever seen, and I greatly hope they make their way to every editor when people start to understand that.

In the meantime, this new vim mode might just might bring me back to ST2 full-time. Here's hoping!


Thanks for adding indent guides; that's one of the must-have features of Komodo Edit for me.


Please do buy it after you'll be convinced that this is the best editor you have ever used :)


Woops, only realized this now ... this should be under some other comment, don't know how this happened :\


Been there, done that, own the downvote.


After this update with indent guides + Vi key bindings I can now consider using this all the time instead of Komodo Edit..


ST looks really promising and I am excited to see where it will go.

I still use Code Browser (http://code-browser.sf.net) which is oriented around folding. One feature from it that I really miss in other editors is the "Clone Window" function that creates a new tab of the same file, scroll and cursor position. IMO, this beats using bookmarks because you simply close the new tab to go back to where you were.


Code Browser has a really interesting approach to organising your code. Does anyone know of any text editors/IDEs that implement code folding in a similar fashion for Mac OS X?


The source did actually compile on OS X once but he hasn't been keeping it up to date and now I get a segfault. I am considering throwing some hours at it because I really want it on my mac..


If you do decide to try and get it compiling then I would really appreciate it if you could let me know how you get on!

My email is in my profile.


btw, you can use "File/Clone File" menu item to get a new view into the current file.


If you're on Windows, I recommend you try Notepad++ which has this feature along with a host of others. I find it to be pretty similar to ST as far as features go.


I would of checked out ST before, but I was thinking it was an Apple product based on the screenshot the article uses (I went back to the beta announcement and it shows the Apple interface as well). I see on the home page you use Windows screenshots now, but I didn't even think about visiting that page last time.

Maybe add some Apple/Linux/Window icons or text on the top somewhere so they show on all your pages? Looking forward to trying it out!


ST1 was Windows-only. I'm taking a guess that jskinner switched to a Mac before starting/releasing ST2; going by the OSX screenshots and he's listing Apple keybindings (Cmd vs Ctrl) first.


I love Sublime.

If you're like me and prefers TextMate's simple cycling autocompletion (usually bound to the escape key) to Sublime's weird snippets-and-best-match tab completion, I made a Sublime Text plugin that gives you just that: https://github.com/alexstaubo/sublime_text_alternative_autoc...


I really wish that there was an auto-update. I've been using the beta for some time now, Jon's amazing constant updates actually becomes frustrating because you have download an installer every update. I would buy a license in an instant if this could be implemented.


Wait, which OS are you running? On the Mac, just opening the editor gives me this handy dialog (note the "Automatically download and install updates in the future" checkbox): http://cl.ly/0e2S0h0O011S0U3p2w0I


Anyone able to get Zen Coding running on ST2? I'm following the instructions at: http://www.sublimetext.com/forum/viewtopic.php?f=2&t=580...


Myself and a number of my coworkers have installed it. You basically just need to clone it into a folder called ZenCoding inside of your Packages folder. You can find the Packages folder by going to the Preferences > Browse Packages… menu entry.

The alternative is using the package manager I wrote http://wbond.net/sublime_packages/package_control. This also gives you the benefit of automatic updates and a whole bunch of other packages at your fingertips.


Package Control is very cool, thanks for creating it. As an author of a Sublime plugin (https://github.com/alexstaubo/sublime_text_alternative_autoc...), how do I submit that package to the list fetched with "Discover Packages"? Do I add the binary package file to my Github repo, and then ask you to add it to the official package repository?


You can fork the package_control_channel on GitHub (https://github.com/wbond/package_control_channel) or BitBucket (https://bitbucket.org/wbond/package_control_channel) and send a pull request. That or you can email me.

You don't need to create a binary package file as Package Control can work directly with GitHub and BitBucket. Simply add the regular https URL to your repository.


Ah, excellent. I went for the pull request method.


Currently stuck on an ancient WinXP box due to my MBP frying itself, so I decided to see how ST2 runs on it. Absolutely wonderful experience @ 1.3Ghz/256RAM, and the vintage mode finally makes it a viable option for all my programming.


For the past couple months, I've been trying to move from ST to vim, but couldn't get over my love for goto-anything; the usefulness of the minimap; and all the little details that made ST a great editor. This is great to hear.


Very well done. The last few revisions has basically turned v2 into my full-time editor for most code. I still found myself reaching for vim so it's nice to have some more key parity between the two now.


I love the UI, but can't seem to figure out how to open a directory without starting a new project. Am I missing something?


You can drag a folder onto the sidebar, or use the command line interface to open a folder. If you are on OS X you need to create a symlink for the subl executable http://www.sublimetext.com/docs/2/osx_command_line.html.


Thanks for the suggestion. That's definitely an improvement.

Though from what I can tell, it just adds the folder to the current project, which feels a bit odd. And having to open up Windows Explorer instead of just doing a File > Open Directory is clunky.


The newest build has "Open Folder…" in the File menu.


Thanks. I just saw that. Not sure why, but I didn't see it until after I restarted the program twice.


Could not download update yet, but I still have a problem with the black tabs. If the tabs matched the project drawer... :)


One cool thing about ST2 is that is it fully theme-able. There is an alternate theme called Soda that has both a light and dark variant. You can grab it with git from https://github.com/buymeasoda/soda-theme or use the package manager I wrote http://wbond.net/sublime_packages/package_control.


+100000. Wow. Package control and Soda is awesome. Where have I been? I never really liked the dark tabs personally and this fixes it! This should be on ST's main page lol.


Thank you very much for that tip, sir. It looks nice side by side with Chrome now. Also, your Project Control is pretty sweet (and its website too).


Wow; Package Control rocks! Want kind of package coverage percentage do you estimate? Great job...


Can it convert files to different encoding? (I noticed "open with encoding", but nothing like "save with encoding")


Is there any way to have it enter command mode instead of insert mode automatically after opening a file?



And also after searching, to not have it enter visual mode, and stay in command mode, the way Vim does.


Sublime is (excluding vim) by far the best text editor i've ever used. I just wish i could afford it.


You can download it for free. As far as I can tell, the only difference in the unregistered version is that it frequently pops a box asking if you want to register.


This (not time limiting) is really useful for folks that want to keep testing it from time to time until some feature is available.


Needs C-[ to double for Esc.


Agreed - I'll make sure this gets in for the next version


Hey, sorry to trouble you here, but I had this problem: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=287... and I can't find a solution anywhere, maybe you have an idea of what I'm doing wrong?


I've posted a follow up on the forum - in general, feel free to email suppport@sublimetext.com if something is overlooked on the forum.


In visual mode, it seems we need to press escape twice to return to command mode. Be good if it could be just once. Glad you've implemented some vim functions like this. I think you're on the way to giving me something I've always wanted - vim sitting on top of a good scripting engine.


Would be cool if folks that bought ST2 could suggest and vote for features.



yep, HN killed the host.


I like how, in the screenshot, line 1337 is presently active. That just can't have been an coincidence.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: