From Sublime Text to VS Code

Ready for a change of scenery?

As a long time Sublime Text 2 user I could never get to grips with other editors. Years of practice meant the key commands were almost hard wired into my brain, and although I tried and liked several alternatives I just couldn’t give up on the multi-editing, super fast searching and simplicity.

Then from out of nowhere came VS Code, an open source code editor by Microsoft(!?). After seeing a lot of good reviews on my twitter timeline I gave it a go, with no expectations.

After playing around with it I was left confused and aroused, it was.. good!

For the last three weeks I’ve been using VS Code exclusively. Although there was some initial friction I am currently liking it a lot.

This post is for anyone curious about VS Code, but mainly for ST2 users wanting to try something.. new. Something similar, but new.

All right. Let me pitch it to you.


Built-In task runner

VC Code will detect any gulp/grunt file in the project root directory. This means you don’t have to have a terminal window running at all times.

To activate a task, simply open the Command Palette with Cmd+p and enter task [task name].

Below: Just entering task will list all available tasks in the gulp/grunt-file.

Built-In versioning control

In a similar fashion, if you’re working on a git repo the editor will detect this and let you view changes, stage files and easily make commits without leaving the editor.

Most editors have some implementation of this, but coming from a terminal git world this is a fresh breath for me.

Below: Showing changes since last commit side-by-side

More than a text editor

This is what I missed the most from Sublime Text. The editor comes with things like:

  • IntelliSense (predictive typing, method suggestions etc)
  • Peek (hover over function/class to view contents)
  • Symbol links (cmd + click to go to symbol definition)
  • Debugging (Currently node.js and Mono only)

Again. These are features you come to expect from a more feature-rich IDE, but coming from Sublime these feel like another bonus.

Have a look at the full list of features here: https://code.visualstudio.com/docs/editor/editingevolved

I haven’t really yet utilised this to it’s full potential, but the plan is to start exploring typescript, which it also knows.

Taken from https://code.visualstudio.com/docs/editor/editingevolved

Bonus features

None of these are revolutionary, but I found them to be a nice bonus.

Color previews

The editor comes with an extensions manager, and the marketplace already has some good ones available.

Installing extensions: cmd + p then type ext install
Looks pretty damn similar…

Gotchas

All right. Let’s be honest, change rarely comes without some pain.

The key shortcuts is gonna be annoying for a day or so. I’ve made the below table which displays common key commands in sublime text 2 alongside the VS Code version.

Work in progress..

I’ve created a Github repo where this table lives. Any contributions to pad this out with Windows/Linux mappings would be welcome.

There’s nothing stopping you from creating custom key mappings for vs code to emulate those of ST2, but honestly it might be better to just bite the bullet and roll with it. It didn’t take that long before my brain was rewired.


Summary

So. Should you jump ship? Honestly, it’s more of a personal preference at this point. Your current editor might already do all of the above. Sublime Text has a ton of great plugins, and I know a lot of people that feel like they could never part with their setup.

I’d say if any of the features outlined above seems like they’d be worth a little hassle, then give it a try.

VS Code being a Microsoft product might put you off, but honestly if it wasn’t for the name you wouldn’t have guessed, it’s not Office. To me it felt like a fresh breath. It looks amazing, it’s multi platform, free and just went Open Source. That’s gotta make it worth a go, right?

Q: Is it going to save the world?
A: No

Q: Is it worth a try?
A: Yes. It’s pretty slick!

Q: Are you going back to Sublime Text?
A: No.

Q: Are you sure?
A: Yes. No.. Yes!