Editors are tools. Rarely, however, do we consider our abilities with an editor as part of coding mastery.
In traditional canvas art, we can see the painter's mastery of their tools in their works. Often times, how artists use their brushes and knives become a defining feature of their art. In software, our usage of our tools is not viewed in the same way. For many, the editor is a blank slate onto which code is written. But one should wonder: if the mastery of our tools was visible in our work, how would it define us?
In many ways, coders are given unique control over our tools. Painter's brushes are made for painters by craftsmen. Editors are made for coders by coders. The result is a flexible suite of features to help us reliably code our creations.
These features fall into a few categories, and knowing some in each will do each of us a great service.
Perhaps the most important editor feature isn't a unique feature at all. Keyboard shortcuts have long been the mainstay in code editors, but many coders know very few beyond cut, paste, and kill line. If coders knew every shortcut and never browsed a menu again, we would all get a lot more done everyday.
The great thing about keyboard shortcuts is they save time on any app you use during development. Some of my favorite keyboard shortcuts aren't even in an editor:
Cmd + L will focus and highlight your browser's URL bar.
Cmd + Shift + T will reopen your last closed browser tab.
When you find yourself in a menu selecting an option with your mouse, make a note of the keyboard shortcut. So many of them will save minutes or hours over the course of a year.
Navigation & Readability Features
We all use syntax highlighting. Other features, like Find, Go to line, and Go to file are used by many to great effect. Often left behind are Bookmarks and Go to symbol.
Bookmarks function essentially as a sequential Go to line. By placing a bookmark, we can recall it, moving our cursor to the bookmarked line and column. When working with a few functions in the same file, this frees us from constant scrolling. Removing the need to manually traverse the code keeps our mind focused on logic, not navigation.
Go to symbol (or Go to function), is a way to jump directly to a function or class name through a search feature. Like bookmarks, this is an excellent way to have an editor work at the speed of thought, without the need for scrolling across potentially large files. Used with bookmarks, large files become nearly indistinguishable from small ones.
Code Efficiency and Reliability Features
Many editor features stem from the need to code faster and with fewer typo's. Find & replace is commonplace. Large IDE's introduced code completion, which i loathe for a number of reasons, but that is a topic for another post. More humble editors come equipped with regex find and replace, word completion, and multiple cursors.
Regex find and replace is a powerful method whose use is predicated on knowing regular expressions. With that knowledge, there is simply no faster way to manipulate large code files quickly.
Word or name completion is as it sounds. It allows you to repeat a word or name from within the file. Not only does this speed up your coding, it also serves to reduce typos as well.
Multiple cursors is, in my opinion, one of the most powerful features in editors today. Functionally, they serve a similar purpose to regex, but in many cases can be utilized quicker. Skilled use of
Cmd + ← and → make these invaluable.
How do we improve?
Stay curious. When we view code we don't immediately understand, we tend to explore it. The same inquisitive mindset can help up to discover the reaches of our editor's capabilities.
Pick a day, every week, to spend 15 minutes learning a feature in your editor's menu you have never used. Then, use it as much as possible over the next week. Sometimes it won't be more efficient to do so, but it will make the usage second nature. Over time, you will find some you hardly touch, while others will become commonplace.
Given the functionality at our fingertips, there are always ways to do things faster. We just need to find them.