Hacker News new | past | comments | ask | show | jobs | submit login
Setting up Sublime Text 2 (drewbarontini.com)
153 points by superchink on May 5, 2013 | hide | past | favorite | 51 comments



One of the things I like most about Sublime is that it just works right out of the box. Sure almost everyone uses a plugin or two, but to me it's the editor that doesn't need blog posts about how to configure it, it doesn't require you to keep a git repository of your thousand-line configuration, it doesn't require an understanding of esoteric key commands to get started.

To me, Sublime is an editor for people who don't want to spend man-weeks fucking with their editor and just want to get to work.


I agree. I also love the way it stores settings as an explicit list of changes from defaults (rather than a list of all settings and their values, default and otherwise), so you always know what's up.

My settings file only has a light theme and trim_trailing_spaces_on_save, and I'm very content with that.

This isn't to dismiss its flexible and configurable nature, which is awesome. I just don't need to do more for now.


It's half-way there. It could go a lot further. I'm really surprised there isn't a single (featureful) editor that follows the OSX/GNOME aesthetic of "convention over configuration; no preferences/options/modes if possible". Key-bindings are the same everywhere you go. Every command is available on every instance of the editor on everyone's machine, everywhere in the world. You never have to re-learn anything; you can just sit down and use all the features.

I would personally imagine something a bit like Sublime, but where all the "plugins" were actually just code contributed to the central codebase, and delivered by updates. (Specifically, I'm imagining it would work like Cloudflare's https://github.com/cdnjs/cdnjs for plugins.)

Given that the editor would then have "everything" in-the-box, it'd then probably have to have emacs-like modes, as well, to allow all the plugins' various key-bindings to live together.


I'd suggest you should download every plugin for ST and see how bloated it becomes, you'd end up with something as slow and ungainly as Eclipse.

To me, one of the largest benefits of ST is having a very powerful editor which is fast, simple, and very usable, and wouldn't want to see the core become much heavier than it already is (although I'm loving the code navigation functionality coming in ST3).


Oh, I'm certain that having all the plugins running code in the background at once would be a horrible experience (in much the same way that "installing every browser extension" would be a horrible experience.) I'm thinking mostly of plugins (packages, really) that just add code you can call through the command system--they don't do anything or consume any resources unless you prompt them to, so why shouldn't they be shipped with the runtime?

But on the other case--what sort of Sublime plugins do you use that constantly run in the background doing something? I don't use any myself that do anything like that; what are some good examples?


I have loaded a TON of plugins at one point. It was nowhere near Eclipse's "oh, you wanted to keep typing? No, sorry I'm going to block while the JVM does a GC sweep, and I try and figure out what auto-completion to show you".

With everything I had loaded in Sublime, it just took a couple of seconds longer to start up. Which plugins were you loading specifically?


> No, sorry I'm going to block while the JVM does a GC sweep, and I try and figure out what auto-completion to show you".

I've experienced this quite often, mainly on large code bases.


To me, after learning a couple shortcuts, it's already there. Not a big deal to learn.

In fact I have set up my Opera browser to use ctrl-pageup and ctrl-pagedown to change between tabs.

It is that ingrained.

If you mean to replace package control, no, please no. I care only about a very specific subset of packages and I don't want the rest.


This is pretty much Textmate to a T. Uses OS X conventions, heavily configured for doing real work out of the box instead of installing 10 packages, has a built-in system for language definitions and plugins. Auto-updates which will include language and theme updates as well.


"Every command is available on every instance of the editor on everyone's machine, everywhere in the world."

OS X is neither on everyone's machine nor everywhere in the world. By a large stretch!


So does Windows Notepad


I know Sublime Text has a lot of momentum, especially on this site, but the one main ting which keeps me from adopting Sublime text is that I can't run it from a terminal. Simple as that.

If I'm going to invest time, effort and know-how into something as fundamental as a text-editor, I want to know that I can run it everywhere I need it.

I'm going to guesstimate that I spend at least 20% of my text-editing via terminals, via SSH, via remote sessions somehow. And there I can't use Sublime Text at all.

In those remote sessions I'm probably editing the same things I do locally, so why should I need to change my entire environment to suit that 20% of the same workload? It just doesn't make sense.

Other objections to Sublime text would be that it's not open source. With more and more (new) arm-based platforms popping up left and right, that becomes increasingly important. I want to know that I can take my tools with me to the places I go. Not being open-source severely limits those possibilities.


You can use the built in 'subl' command to launch Sublime Text 2 from the terminal.

http://www.sublimetext.com/docs/2/osx_command_line.html

Editing remote files is as simple as an SFTP mount.


That is for OSX, which I refuse to use on an principle of ethical software conduct. Apple is hostile to open software and computers as open platforms. They want to take away the open nature of computers which allowed them to exist in the first place and they use BS patent-lawsuits to hinder competitors willing to provide just that.

They are evil and I refuse to support them with a penny or any significant effort or attention.

Apart from that, talking about SFTP mounts is completely missing the point.

Sometime I'm in a terminal, on a router, NAS, cloud-server or whatever, and need to edit some files in the current folder.

What I do then is "$ emacs file", not change context, go to another local terminal and fuse-mount some completely remote FS with whatever keys and credentials I need to provide, in /mnt/remote/, and then fire up a local editor for /mnt/remote/the/actual/directory/i/was/working/in/file.

That's extremely inefficient.

When I say I need something to work in a terminal to be a proper solution, I mean any terminal.


In every sublime text thread there's someone praising Vim.

If you want a terminal text-only editor, and already have one like emacs, then you don't need or want sublime text.

Sublime Text does not try to work in the terminal and I love that it doesn't.

Very different use cases. I suspect you are simply a very subtle forum troll.


Then stick with emacs. It sounds like its the perfect tool for your needs. Which is perfectly fine, right tool for the job and all that. That said, I would suggest that the ubiquity if vim (and latterly that of nano) renders your point a little pompous. No need for the same old pious rhetoric.


I fell for the peer pressure and tried to use a macbook some time ago and I feelt like I was in the movie "the island", but I wouldn't say that apple are any more evil than other companies in the IT industry.

So here I am running linux once more.

I have a lot of time invested in emacs but I have switched to sublime since early versions of v2-beta. My main reason was at that time the ruby and RoR modes for emacs wasn't really up to speed.

I like sublime text and I don't regret jumping on that train. Easy to get started, lots of features and plugins, highly configurable. I use sublime as my main "desktop" editor now.

When editing over ssh emacs is my preferred editor, after 15 years of using emacs as my primary editor I think I have enough emacs keystrokes deeply imprinted in my brain to last me a lifetime ... :)


That little rant seems like some significant effort and attention. That said, Sublime clearly isn't the editor for you, but it can be invoked from a command line, which I use every day.


Now, I know you mean running it within the terminal a la vim/emacs/nano etc, but you can set up sublime to run from terminal in linux (I set it up successfully on fedora, after ten minutes googling).

The downside of that is that it runs as an x windows in comparison to directly in terminal, which is a bit of an bummer when trying to work remotely. As much as I'd love for it to run in term, it'd pretty much just be a vim-alike, and why reinvent the wheel.


Sublime is more for software development. It sounds more to me like you're needing to edit config files and such. In that case, look no further than vi/emacs. They fit your needs. If you're looking to do development of anything more than a quick Perl/Python/Ruby/Bash script, then you might want to consider a development environment... which Sublime fits perfectly. For editing my apache.conf, I use Vim.


There is always nano.

I use ST2 when working on large, involved python projects or latex files. If I have a small file, vim or nano is sufficient to pound out the changes.


``subl`` also works in both Windows and Linux.

If you're a huge OSS proponent though, then Sublime is quite clearly not for you anyway.


way to miss the point. op needs it to run _in a terminal_.


There are a lot more keyboard shortcuts for this editor, makes you much faster if you don't have to touch a mouse.

Here's a "cheat sheet": http://i.imgur.com/yGrUAL8.png


Printing as I type, thanks so much for sharing this. Saw a few that I didn't know about and others that I google far too regularly.


Can you do one of these for Windows keyboards?


It would be great if this cheat sheet existed as a page instead of an image. Unfortunately, I can't Ctrl+F an image.


Nice guide. I'm surprised Aqua didn't make it to the themes section - a theme to make Sublime look more native on OS X: http://github.com/cafarm/aqua-theme

CommandOnSave is a nice plugin that I've been using recently, very useful for automatically running Makefiles on save, etc.

Also, if you want to browse Hacker News via Sublime Text, here's a small plug for my plugin: "Hacker News" (https://github.com/kaolinite/HackerNews-SublimeTextPlugin)


I've updated the article to add the Aqua theme link. I'm surprised I missed that one.


Here are a few plugins I rely upon that make Sublime much easier to use (that weren't on that list).

* GitGutter: Adds symbols beside the line # on modified lines. A feature widespread in other editors with Git integration. I haven't found a plugin to mark modified files in the sidebar (which is also another common feature). - https://github.com/jisaacks/GitGutter

* Missing Palette Commands: Adds a few commands like setting the indentation for the specific file only. You can see a full list in the link. - https://github.com/fjl/Sublime-Missing-Palette-Commands/blob...

* Open Folder: Open up the selected folder in explorer/etc.

* Terminal: Open the selected folder in the terminal. - http://wbond.net/sublime_packages/terminal


GitGutter is awesome, thanks for sharing :)


This video taught me a ton of stuff I had no idea about: http://www.youtube.com/watch?v=TZ-bgcJ6fQo

Quite long, but definitely worth it. Not affiliated with whoever did it.


Great video, thanks for sharing. The automator osX hack to get right-click open project in Sublime is worth it alone!


Been using Sublime Text for awhile now and I'm always finding something new. One thing I'd like to point out is that it actually supports multiple selections by default and you don't need to enable VIntage mode to take advantage of the huge timesaver: http://www.sublimetext.com/docs/2/multiple_selection_with_th...


GoSublime [1] is also an awesome plugin if you write Go code.

[1] https://github.com/DisposaBoy/GoSublime


Great guide, it covers most of the must have plugins.

While everyone is talking about themes, if there are any Intellij 12 users out there that fancy the Darcula theme, I've created a theme for both Intellij 12 and Sublime Text 2 which is a blend of Solarized and Darcula: https://github.com/rickhanlonii/Solarized-Darcula


Amazinginly helpful article (especially for first timers). Another addition I'd like to add to the list if you use LESS is the LESS Build plugin: https://github.com/berfarah/LESS-build-sublime — allows you to compile LESS stylesheets by hitting control + B on Windows to compile.


I really enjoy working with ST2 and I would be super happy if there was a faster workflow for file / folder creation. I would really like to see something that helps me Cmd-Shift-P and type "New Folder" or "New File", type the name and be able to do tab-completion in it (and thus also map it to some keystrokes).


Have you tried the AdvancedNewFile plugin? It uses ctrl+alt+n by default, lets you create folders when you specify your new file and also has tab completion.


this is a tutorial worth watching for beginners and advanced users, https://tutsplus.com/course/improve-workflow-in-sublime-text... an hour or two of investment, could save countless hours of work.


Anyone have a plugin that prevents ST2 from showing the contents of binary files? For example, clicking on a JPG in the sidebar shows the contents, requiring you to somehow close the window before you can continue.


Not sure on a plugin, but perhaps adding image formats to your file_exclude_patterns could be a workaround?


Thanks for the suggestion, but I still need to be able to see them in the sidebar :(


And I suggest you to install Sublime hacker News Reader too :) (from Package Control)

https://github.com/Dimillian/Sublime-Hacker-News-Reader


It was only yesterday that I thought about using animated GIFs for demoing code typing. That's what I liked most about this post!


I disliked how I had to watch the gifs a couple of times though in order to read exactly what he typed for the first snippet to see how it related to what it filled. Text underneath would help, but it does indeed look nice.


Good point. I just updated the post to fix that.


Wow, it's as complicated as setting up a bare bones linux install.


How do you put downloaded themes into Sublime Text 2?


Is there a particular theme you're interested in?

Two options:

1. Download package control [1] (first config listed in OP) and then search for themes.

2. Visit the individual theme repos (mostly on GH) and follow instructions.

[1] http://wbond.net/sublime_packages/package_control


DetectSyntax is called now ApplySyntax




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

Search: