Mastodon

Turbocharging your dev environment

— 6 minute read

Keep your hands and arms inside the keyboard at all times...
In my past life, I liked keyboard shortcuts and application customizations that sped up my photography workflow. In my NEW life as a Flatiron School student and developer, I LOVE keyboard shortcuts and application customizations!

While (most) every Flatiron and Learn.co student starts out with a pretty solid dev environment on their machine after installing the Learn app, I wanted to dig a little deeper into how to make my applications fly (and look great too!)

Sublime Text and Atom
Out of the box both Sublime and Atom text editors are awesomely powerful. Keyboard shortcuts unlock a ton of speed and control that make these text editors absolutely fly. As developers we're supposed to be typing, not hunting around with a mouse!

First a primer on Mac Glyphs:

  • ⌘: Command
  • ⌥: Option or Alt
  • ⌃: Control

The following text selection shortcuts are like magic in Sublime and Atom:

ShortcutExplanation
⌘ + DSelect the current word. Press it again to select the next appearance of the same word. This is REALLY useful for changing a lot of variable names at once.
⌘ + LSelect the current line. Same behavior to select subsequent lines.
⌘ + ⌃ + up/down arrowmove the current selection up or down. Great for moving a binding.pry or a selected line of code.
⌘ + returnmake a new line of code after your current line
⌘ + shift + returnmake a new line of code before your current line
⌘ + fn + Xcut the whole current line.
⌘ + /comment out the current line
⌘ + topens a new tab with a search box. Type in the name of the file you want to open

Also, as our fearless Time Lord leader Steven Nunez has pointed out, this one takes an adjustment in the Mac OS X preferences. In System Preferences -> Mission Control. Remove the keyboard bindings from "Mission Control" and "Application Windows" here:

Mac OS Mission Control Preference Pane
Mac OS Mission Control preference pane

Now you can use ⌃ + ⌘ + up arrow/down arrow to select lines of code. This is great for quick bulk commenting out of lines.

There are a ton more shortcuts I use regularly, like line indenting and duplicating lines. You can find a whole reference of shortcuts for Mac here.

If you really want to get your shortcut mojo going, step into the shortcut Dojo at Shortcutfoo.com, and practice your shortcuts daily.

Package Control
On top of the included keyboard shortcuts, both Sublime and Atom are highly extensible. Atom comes with this pre-installed in the Atom Preferences ( keyboard shortcut for preferences in any app? `⌘ + comma`)

I've been playing with both text editors trying to find a favorite, so I've played with packages for both.

Sublime Text
First off, you should install Sublime Text Package Control, following the instructions at this link. With Package Control installed you can browse, install, and manage the full repository of packages at packagecontrol.io from within Sublime Text.

With Package Control installed, use keyboard shortcut  ⌘, shift, p to open Sublime's Command Palette. Now start typing Install Package, hit enter and you'll have a searchable list of packages available.

Personally, I've been using Bracket Highlighter, which shows you the beginnings and ends of your brackets in the gutter (where the line numbers live). This even works for Ruby def and end, class and end, etc.

Sample of Bracket Highlighter Package in Sublime

I've also been using SideBarEnhancements, which extends a lot of right-click capability to Sublime that comes default in Atom, like "Move to Trash", "Open With" etc.

Atom
Atom has many of the same kind of extensions available at this site, but they can also be browsed from within the application, and settings played with in a nice GUI.

Must-haves in my book are minimap, which brings a Sublime Text style minimap to the right side of your editor, so you can zoom around big files, highlight-selected (and minimap-highlight-selected) to help you see all references to the word you have selected, for hunting down typos or just tracing back through your code.

Another powerful Atom package is git-plus. This great package lets you execute git commands without ever leaving Atom, from the Command Pallete ( ⌘, shift, p ). Make a new branch, stage your files, commit and push all without switching to the terminal. Atom's git integration is already very cool, tracking file changes in the sidebar, and git-plus adds even more power to that relationship.

There's also countless visual customizations to make in both your text editor and terminal, but those will have to wait for another blog post!

Launchbar or Alfred
Now with 100% more Dash integration!
My personal favorite: Launchbar was a precursor to the Mac OS X Spotlight search (⌘ + spacebar) and is a good deal more powerful. Launchbar integrates with a ton of other applications on your computer to take you to warp speed. Search for a file, and you can move it to a new folder, or launch it with any application that knows what to do with it. Send a text message straight from Launchbar. You can even set up your own search definitions (type g, then space and start typing in the launchbar window for a Google Search, complete with auto-complete!)

Example of Launchbar for Mac OS

There's a ton of keyboard power to be unlocked with Launchbar (you can use it free as long as you like, but after the free trial it will force you to take a break on occasion).

My favorite new integration is (again courtesy of our Flatiron's resident time lord Steven) is integration with programming documentation program Dash.

Dash is Ruby-Doc (and any  other programming documentation!) on steroids. If you want to look up the textbook definition of a method, Dash will get you there a million times faster than going to the ruby-doc site.

Example of Dash Documentation Software

To travel at warp speed, open Launchbar, type Dash then space, and just start typing what you're looking for! Launchbar ties right into Dash to get you where you're going!

Example of Dash integrated into Launchbar

And then there's the simple matter of remapping Launchbar invocation to the Caps Lock key... but that's a post for another day!