A great philosopher once said:
Programming knowledge is nothing if you can’t move your fingers on the keyboard fast enough.
Not sure about the author of this quote but it doesn’t matter and it’s still true.
I used to be very frustrated. I knew a lot about languages, computers theory etc. But when it came to typing code I was so inefficient that it was a pain. I wrote some very bad code because of that.
Then I thought about the situation. I’m a guitar player. I know some music theory but what makes me a guitarist is the fact I can actually move my fingers efficiently on the fretboard. Same goes for programming. I mean the typing skills not the fretboard.
So let’s see how you can become a code editing hero.
IDE vs Text Editor
To get started I would like to answer the eternal question:
Should I use an IDE or a Text Editor ?
Bear in mind that this is my personal point of view but I would say: Unless you’re using a technology that requires more boilerplate generation than actual code (ask yourself if you’re spending more time clicking in menus than writing code) an IDE will get in your way.
As an example I’m working with Ruby on Rails a lot. And I really love what the JetBrains folks did with their RubyMine IDE. I even own a license. But when I want real efficiency I always find myself opening my terminal and code editor.
In any case for your editing practice please go the text editor way. Powerful tools should assist you not to address a lack of skills.
Picking an Editor
OK. We agreed on the text editor thing but we’re not there yet. Now you need to find which one suits you best and I’ll present a few of them to you.
As you may guess there are tons of editors on the market and if you kindly ask your friend Google it will provide you with all the information you need on the topic.
Wikipedia can help too:
- List of text editors: https://en.wikipedia.org/wiki/List_of_text_editors
- Comparison of text editors: https://en.wikipedia.org/wiki/Comparison_of_text_editors
I will just focus on four of them. Two elders still widely used and two of their young contenders.
Vim is a clone of an old editor called Vi. As the name suggests it brings some improvements to this one (Vim means Vi improved).
Vim is fast and extremely powerful. It can be extended to fit almost any workflow. Its users believe Vim is the best editor known to earth.
The particularity of Vim is that it works in two different modes. A command mode where, guess what, you can execute commands and act on your text and an insert mode where you actually edit your text.
But this power comes with a price. It has a very steep learning curve. Switching between the two modes requires habit and the amount of commands could fill a whole book. Customising it to your taste is a lifelong task.
I personally gave up on Vim a long time ago but still planing to give him another try soon. I saw some people being insanely productive with Vim ans still believe it’s worth mastering.
Another thing to note is that Vim is present by default in almost every UNIX / Linux system. Knowing at least its basics can be very useful in some situations.
If your confident with your keyboard mastery and feel like taking the leap: http://www.vim.org/.
Emacs was my first serious text editor back in the 2000’s. Even more than a simple text editor it is so extensible that it can be turned into a complete IDE.
Customisation is made via Lisp which can be confusing at first but is quite convenient once you get used to it.
Emacs doesn’t have a modal functioning like Vim so most of the operations is made through combination of shortcuts. Coding with Emacs sometimes feel like playing piano.
The battle between Emacs and Vim users has been raging for years and it’s not likely that it will be ending soon. In the end both are very powerful editors with steep learning curves and choosing Emacs over Vim is a matter of taste.
If you’re agile with your hands – give it a try: https://www.gnu.org/software/emacs/
Sublime Text is a more modern text editor than the former two.
It was originally a plugin for Vim before being a standalone editor. I still provides a Vintage Mode which combines Vim commands with Sublime Text features.
Sublime Text is a very powerful editor, extensible via plugins written in Python. It provides a lot of shortcuts, more natural than Emacs ones for people used to operating systems like Windows or OSX.
All the commands can be launched from the command palette which is great for newcomers not used yet to the shortcuts.
Sublime Text introduced some great features like the ability to have multiple cursors.
Some former Vim users even reported that they switched to Sublime Text and never looked back. Some others say the opposite.
If you would like a serious and powerful editor but are scared by Vim and Emacs learning curves, Sublime Text might be what you’re looking for.
Atom is one of the new kids on the block. It is a text editor created by GitHub who looks a lot like Sublime Text.
It shares a lot of functionalities with the former and provide almost the same keymap by default.
You can even display the Chrome developer tools and inspect your editor elements like you would for a Web page.
Out of the box it feels more complete than Sublime Text. I mean there is a built-in package manager, more integrations, a number of colour schemes … But nothing you can’t get with the former.
In the beginning it was highly criticised for being slow and a bit resource consuming. It seems to be a lot better now.
The advantage of being build with the most used web technologies is that there are a lot of plugin developers and almost anyone can write them.
I’m currently using it as my main editor and I must say I’m happy with it.
Wanna try it too? https://atom.io/
Found your favourite editor? Awesome. Now it’s time to talk about your keyboard itself. Or at least its layout.
You’re aware that there are many keyboards layouts commonly available depending on the countries. QWERTY, AZERTY, QUERTZ …
These are more or less adapted for different natural languages. Adapted but not even optimised. They come from a time people were typing on mechanical typewriters. But are they the best solution for coding?
If you’re writing code all day long, chances are you are at least using a QWERTY layout. If not, you should. Programming is done in English and QWERTY is the main layout for this purpose. Plus it has a good access to common signs used in programming.
Though like we said it’s an old layout from the mechanical era. We can do better.
Dvorak and co
Dvorak is an alternative layout optimised for the English typing as well. It is not named after the five first letter keys but after one of its creators August Dvorak.
I often hear that it allows to type faster than with the QWERTY layout. I’m not sure about that. But what is true is that it allows a more comfortable typing, reducing the movement of the hands on the keyboard. The most used keys are located on the home row.
For an example check out the video below.
If you already touch type efficiently with your current layout I guess you’re fine and you don’t need to re-learn a new layout except if you would like to.
Otherwise you will need to learn touch typing to be really efficient and changing layout is a great opportunity to build good habits from scratch.
Don’t try to find a keyboard with the corresponding layout, stickers for your keys or anything. The goal is to type without looking at your fingers and if the symbols on your keyboard don’t match the layout it will remove the temptation to cheat.
You need to build muscular reflex.
There are plenty of alternative optimised layouts. I personally use Bépo which is a Dvorak variant allowing easy editing of both French and English languages while still being efficient for coding.
- Text editor: check!
- Keyboard layout: check!
Your last step is to learn touch typing. Which means typing without looking at your keyboard using all of your fingers.
Fortunately there are many ways to learn and plenty of tools to help you with that process.
Klavaro is one of the most used tools for that. It is available for almost all OS.
It will make you learn touch typing through progressive exercises.
You can download Klavaro here.
Most of us spend hours every day writing code. If you really want to boost your productivity and get serious about that, avoiding moving a cursor around with your mouse or touchpad is mandatory.
Bear in mind that coding is an intellectually heavy task and you don’t want the mechanical process of writing text to get on the way and consume energy. If you’ve been driving a car for a while , chances are that switching gears, braking, accelerating etc … has become an unconscious process allowing you to be highly focused on the road and avoid accidents.
Things work the same way for editing. There is no added value in processing text so make it an automatism for you by mastering typing and knowing your tools by heart.
All of this requires some time and you might feel that you’re losing productivity at first. But believe me it will pay-out.
If your work allows you this productivity loss for a few days, do a full switch at once, editor, layout … Otherwise try do devote more and more time every day as you progress.
Good luck on your path to editing mastery. And feel free to share your tips or your story if you already went that way.
Photo courtesy of Markus Spiske