The keyboard and the mouse are the most common devices that interface us with computers. We don’t have brain-computer interfaces just yet, and we need to rely on them to help us do precisely what we want when programming.
Fortunately, there exist some strategies that help increase our productivity. Here are essential life hacks that optimize typing and make programming way more enjoyable.
Learn touch typing, here’s how
Touch typing is a style of typing without looking at the keyboard. Learning this method at first seems like a downgrade. After all, why change something we’re comfortable about? Even if you like your current typing style, consider learning touch typing.
Sure, it won’t be easy. After all, you’ll be rewiring your brain to gain new muscle memory. But once you get the hang of touch typing, a keyboard will feel like an extension of your arm. You’ll type faster, make fewer typos, and focus your eyes entirely on the task at hand. Also, it’s really rewarding and looks professional.
How to learn touch typing? I used this site to get the hang of it.
Use the same keyboard model at home and work
When using different keyboards at home and work computers, you need to rewire your brain a little every time you go back home or go to work. Every keyboard has a slightly different layout and stroke depth. You can easily avoid that extra cognitive effort and streamline the typing process by sticking to one keyboard model.
Reduce your use of the mouse
While programming, you often need to switch between windows or workspaces - especially when you’re responsible for development tasks in multiple projects. Using the mouse for switching windows is just inefficient. It takes time and may lead to errors. Almost every operating system offers some support for keeping your focus when switching between windows by using shortcuts. Here’s a helpful list.
If you like PyCharm, you can set your own shortcuts to optimize your work further. Check out this guide.
Change the windows manager to tiling manager
Tiling window managers like i3 help to organize windows and are primarily targeted at advanced users and software developers. They allow switching focus, moving windows around, and organizing them into tabs by using just a keyboard. They’re usually lightweight really simplistic and blazing fast.
I tested a few of them and chose i3 because of its configurability and ease of use. In general, it’s good to try that type of software out yourself because every developer follows their own unique style of work.
Create shortcuts to automate the most frequent actions
Once you get the hang of touch typing, you might find using keys like arrows, backspace, enter a little uncomfortable because of their distance to “base keys” F and J. What you can do to remedy this is remapping those keys and use ctrl+j, ctrl+i, ctrl+k, ctrl+l as arrow keys. You can remap other keys similarly for higher productivity and speed. It will make you type faster.
You can do that in several ways. I use software called AutoKey, the universal tool for that purpose. I really like the "abbreviation" tool; it’s a short sequence of letters, numbers or symbols that when typed will trigger AutoKey to do something - like run a script, insert a phrase, display a menu. The good thing about it is that it uses Python as a scripting medium. That way, we can write some more complex scripts for automating tasks.
Decrease repeat delay and increase repeat rate
Repeat delay is the pause between pressing a key, and the moment it starts repeating. Repeat rate is the speed at which the pressed key is repeated. Both these values may not be optimal for software developers.
You can change them by using the following command:
```xset r rate 200 50```
The first number refers to the number of ms after which the key will start repeating. The second number refers to the number of repetitions per second. So, after 200ms of pressing a key, the system will generate 50 keys a second.
Use Bash or Zsh on steroids
Developers can optimize their work with the terminal a few ways. Let’s start with the basics: shell is a command line interface (CLI) that allows interacting with the computer’s operating system. Most people use graphical user interfaces, but switching from the mouse to typing in the command line is a huge productivity boost.
Bash is basically the default shell on Linux and Mac OS X. And Zsh is an interactive shell that includes many useful features from other shells and other helpful additions like better auto-completions and globbing, path replacement, spell correction, and many others.
Developers can also take advantage of useful GitHub prompts like magicmonty/bash-git-prompt which come with a lot of options that make writing code easier.
Don’t forget about dotfiles
Dotfiles are plain text configuration files on Unixy systems for the shell, ~/.zshrc, editor in ~/.vimrc, and many others. Developers use them to customize their systems. The dotfiles community has produced a vast number of repositories and registries that contain organized dotfiles, dotfile managers, and advanced installation scripts.
Most of the time, we store our files not only on our machines but also local drives or in the cloud. That means your documents, photos, etc. are safe from risks like theft, damage, or hardware failure. But what about system preferences, configurations, or even reinstalling every single application? Using dotfiles, we can automate the installation of system tools, settings, and applications.
In the words of Lars Kappert: “Today, I could literally throw my laptop out of the window, buy a new one, and be up and running in a matter of minutes (not hours!). Without breaking a sweat (apart from the $$$).”
To get started, you simply need to organize your dotfiles in a directory. The best option here is a hosted git repository like GitHub.
To see what’s out there, check out this comprehensive list of dotfiles.
Here’s an example of what can expect from dotfiles: .alias is one that allows defining shortcuts for commands, add default arguments, and abbreviate longer one-liners. Isn’t that awesome?
Plugins for JetBrains and VSCode tools
This one can be really helpful if you’re just starting out. Newbies using tools like JetBrains and VSCode can download special plugins that show how an action completed using a mouse could be instead carried out with a keyboard shortcut. Learn the shortcut is an excellent example of that.
I hope these tips help you write better code, faster. Do you know any other productivity tricks for developers?