I’ve been using Jasmine 2 on a recent project and I wanted add JSHint as part of our Jasmine build. On a previous project I had used Brandon Keeper’s approach and started there. The core of his solution works with … Read more
The virtues of having a fast build have been well extolled. While there are strategies for speeding up an existing slow build, let’s look at a tool that can help us keep us from getting in that position. We will … Read more
Let’s look at a simple approach to parallelizing a test suite for a Ruby app. Parallelizing your specs can be a good strategy to get a speedup on an existing slow suite. It can also be employed early on a … Read more
- RubyMine 4 is scrolling to the bottom of the window when displaying test results.
Click the gear in the test runner window and click "Select First Failed Test When Finished"
- grep_routes Tyler from Boulder office mate Everlater wrote a gem called grep_routes. It lets you search your routes without loading all of Rails. Only works with Rails 3.1 and 3.2.
Update: I had some of the Ctrl and Option commands switched. Fixed now.
As Rails developers, we spend most of our day in two places: an IDE/text editor and the command line. While we spend much time learning shortcuts that help us write and refactor our source code more quickly, many of us are perfectly okay just learning Ctrl + A and Ctrl + E and holding down the arrow keys to place the cursor where we want to get to on the command line.
Don't do that. With only a handful of additional commands, your day to day interaction with the terminal can be much more pleasant. Here are a few ways to do that using terminal and the bash shell.
A Command Line Editing Starter Pack
Here's a quick list of commands that you'll get a lot of day to day usage from, if you aren't already:
- Ctrl + A: Move cursor to the beginning of the line
- Ctrl + E: Move cursor to the end of the line
- Ctrl + K: Delete from cursor to the end of the line
- Option + F: Move cursor one word forward
- Option + B: Move cursor one word backward
- Option + D: Delete next word
- Option + Delete: Delete previous word
Note: You'll need to set your meta key to Option before the commands that use Option will work (see below).
These seven simple commands will help you move more nimbly when editing text on the commands line. There is certainly plenty more you can do, which you can find in the bash manual.
A Word on Modes
By default, the bash shell run in emacs mode. This means that emacs shortcuts are enabled by default.
Emacs mode uses a Meta key for some commands, and the Option key is a good choice. In Terminal on OS X, you'll need to enable this by going to Preferences > Settings > Keyboard and checking "Use option as meta key."
You can also tell bash you want to use vi mode for command line editing with
set -o vi, if for some reason you want to type
i before every
ls you write.
Nothing new or overwhelmingly exciting here, and there is certainly much more to dive into if you are so inclined. However, this small set of commands will have you covered for the majority of your day to day command line editing needs and is what I would consider constitutes a minimum level of proficiency.
Give your arrow keys a break!