I forget sometimes how much I rely on the keyboard to select and manipulate text as a software developer. It makes me very productive simply because I take less time to get work done. I encourage all developers to rely on their keyboard more and their keyboard less.
I spent time this past weekend using a hand saw to cut a fallen branch down to smaller pieces so I could move them to my burn pile. It was a lot of hard work using the hand saw. If only I had a chain saw. It would have made the job so much easier and it would have taken a fraction of the time. As my father always says, “for every job there is the perfect tool.”
I see the same situation quite often when I see developers use an IDE, like Visual Studio, to code software. They rely heavily on the mouse to click and select text and to modify the code. This is the equivalent of cutting a tree by hand. I wonder how much more productive developers could be if they had the equivalent of the chain saw. Enter, keyboard shortcuts.
So much of what we do as developers involves creating and manipulating text. It makes sense for us to be a efficient as we can be to maximize the amount of work we can get done in a given time. Using your mouse to navigation around and to select text is very slow compared to using text shortcuts. If you want to be a better programmer, then learn to rely on the keyboard more, and less so on your mouse.
Here are some basic keyboard shortcuts I would want all developers to learn. Once one has mastered these shortcuts, I guarantee you’ll be able to get more work done in less time.
Full disclosure, these are for Windows only. But you should be able to find the equivalent shortcuts on other operating systems as well since the vast majority of these are the same everywhere.
I have used these shortcuts for so long they are second nature to me. Note that the selection will always start wherever the cursor is located.
|Select the text to the right (1)||
|Select the text to the left (1)||
|Select the current line of text||
|Select the preceding line of text||
|Select to the beginning of line of text||
|Select to the beginning of the file||
|Select to the end of line of text||
|Select to the end of the file||
(1) Depending on the editor, the selection will stop at the first white-space character or non-alphanumeric character.
To select multiple times, hold down SHIFT or CTRL + SHIFT, and press the arrow key multiple times (or hold the arrow key down to select more quickly).
CTRL + C Copy
CTRL + X Cut
CTRL + V Paste
CTRL + Z Undo
CTRL + Y Redo
These are pretty much universally supported in every editor, IDE and operating system.
|Move Left by one word||
|Move to the beginning of the line||
|Move to the beginning of the file||
|Move Right by one word||
|Move to the end of the line||
|Move to the end of the file||
Again, holding down the arrow key will make the navigation move more quickly.
Your Favorite Text Editor
You don’t have a favorite text editor? I would urge you to find one. Mastering all the keyboard shortcuts in a particular Text Editor can be one of the most important skills you can ever have.
Not only should you learn to select and manipulate text, you should also
learn master the way the text editor allows you to find and replace text, have multiple files open at the same time, navigate between all the open files, etc.
As an example, one universally supported navigation shortcut is
CTRL + TAB. It switches to the previous tab in a multi-tab user interface. Works in every text editor I’ve ever used, every IDE, even most web browsers support this shortcut.
Learn Your IDE
Each IDE is different, however you will find that most (if not all) will support default keyboard shortcuts for most of its popular tasks. And allow you to assign custom keyboard shortcuts and modify existing ones.
The reason shortcuts are so widely supported in IDEs is no accident. Developers will expect this high level of support for shortcuts. It makes them more productive and who doesn’t want to be more productive?
Keyboard shortcuts make you more productive. Learn them, practice them, master them.