Setting up my code editor

development, productivity, tips

My goal is to eventually have this all captured in the automation I use to setup a new machine, but for now this post serves as a place to record the tweaks and improvements I've made to my code eidtors over the years, as well as documenting some of my workflow choices.

At some point my editor setup will be handled by my starter repo. It already covers installing my common applications, utilities, etc. The main piece missing for now is configuration of some of those applications, including my editors.

Editors #

Over the years I've used many editors to write code, everything from MS-DOS Editor to Eclipse and Xcode. Occasionally a new competitor emerges that grabs my attention and I'll try it out for a while in parallel with my current editor(s), for example Brackets in 2014, then Atom and Visual Studio Code in 2015. Most of the time I end up underwhelmed and stick with my existing editor.

Today I use two editors for the majority of my work:

  • Sublime Text - I've been using it since 2011 and it's been an all-round great editor. Multiple cursors was a game changing feature when I first started using it, and I still find new ways to use it today. Sublime is definitely one of the fastest editors I've used, even on large projects or files. Its plugin system provides some really useful additions, and I've even written a few for my own specific needs.

  • Visual Studio Code - I've tried this many times since it launched and the first few times it didn't quite measure up to my years of muscle memory and configuration tweaks in Sublime Text. Recently however I've been giving it another go and I'm pleasantly surprised at how far it's come in the past year or two. There are still a few things that bug me about it but they're being addressed, and performance (while not yet quite on par with Sublime) is more than adequate for almost everything I've thrown at it.

I'm starting to use VS Code more each day. Sublime is a great editor, fast, stable, and for a long time did everything I needed (with the help of a few plugin of course). However, it's been through a few rough patches over the years, poor communication on the part of the developers left its future uncertain for a while. As a result many in the community, including some plugin authors, started looking for an alternative. This has meant that some plugins I use are no longer maintained, or have limitations that get in the way too often for me to ignore.

Why VS Code? #

Community support, features, stability, extensibility and customisation, … VS Code has gained huge popularity since its release, and for good reason. Quite a few of the authors of popular Sublime Text plugins have released versions for VS Code, and indeed it seems some of them are more advanced than their Sublime Text counterparts.

In my opinion Sublime Text's speed is no longer enough for it to prevail. Features that once made it stand out are now common in most modern editors. Even with the addition of plugins, Sublime is missing functionality that makes a huge difference to a developer's productivity, or where provided by a plugin can often feel like an afterthought that's not fully integrated into the editor.

Some examples of features that ship out-of-the-box in VS Code that require additional plugins in Sublime:

  • built-in language support for CSS, SCSS, HTML, JavaScript (including JSX), JSON, and Markdown
  • IntelliSense (code completion)
  • syntax highlighting, colour preview
  • Emmet abbreviation and snippet expansion https://emmet.io/
  • syntax verification and linting
  • auto-close tags and auto-update tags
  • formatting
  • auto-import
  • debugger

Important features #

One Sublime Text feature I use heavily is Projects, allowing me to easily switch workspaces, restoring context, settings, etc. So far it doesn't seem like VS Code has this functionality built-in, instead if requires the use of an extension such as Project Manager. I haven't tried this out yet but it appears to provide most of the same functionality.

An extension that impressed me when a colleague first demonstrated it to me in 2017 or 2018 was Git Lens which enhances VS Code's built-in git functionality, integrating git blame into the file editor for example.

Having built-in markdown preview is another win for VS Code. I write quite a bit of markdown, at work, for open source projects, and for this site. The built-in support is great, and speeds up the process compared to the plugins I previously used in Sublime.

It's not just extensions that are useful, sometimes seemingly small customisations in the editor styles or layout can make a big difference. For example, in VS Code I move the sidebar to the right of the window, meaning the content of my editor pane doesn't jump around when expanding / collapsing the sidebar. It's surprising just how distracting and disruptive moving text can be, so having the ability to avoid this is a big win in my book.

Plugins / extensions #

Here are just some of the Sublime Text packages I've used at one time or another:

-