Save time. Increase productivity. Here are several small things that will make you a bit faster, and your work a bit more enjoyable. I hope you'll pick up at least one or two things. You can go wild and use all of these. It's a good start if you want to progress into a real power user.
Notes:
- Several GIFs ahead. Just click on it to stop it looping.
- Hotkeys used are for MacOS, but if you replace ⌘ with ctrl you should be all set for Win/Linux.
Use your cursors wisely
The same way a craftsman uses his hands as tools in the physical world, we use our mouse and keyboard as a tool in the digital world. It may not be our most important tool, but nevertheless as a tool we should be always looking to improve how we use it.
Copy a single line
Everyone knows how to copy a line right? (⌘ + C)
Some might not know that you don't need to go through the pain of highlighting a line in order to copy it. Put the cursor anywhere on the line, hit the shortcut and the line will get copied.
People struggle clicking three times to highlight the line, sometimes they click the fourth time, highlighting the whole text. Or they drag the cursor along the line usually messing up the highlight or end up missing a couple of characters.
Place the cursor in position and hit that shortcut!
Remove a single line
The same cursor placement magic that applies when copying a line also applies when removing a line. The quickest way to remove a line is placing the cursor anywhere on that line and hitting ⌘ + X.
One thing to note here is that ⌘ + X cuts the lines, it does not delete them. So it affects your clipboard, or the clipboard manager that you use. You do use a clipboard manager right?
If you actually want to delete the line then you should use a different shortcut, ⌘ + shift + K. The shortcut is for VS Code, it might differ for other IDEs.
Since the above shortcut is a bit harder and takes a bit more time to perform than the one for cutting, my preference is ⌘ + X.
Multi-cursors
Place one cursor to edit a single line, place multiple cursors to edit multiple lines! Multi-cursors are your friends for fast simultaneous edits.
Once you get a hang of it you'll love it as it makes coding a lot more fun. The two main shortcuts are ⌘ + D which selects the word at the cursor, or the next occurrence of the current selection, and Alt+ Click that adds secondary cursors.
This was a game changer for me, and I used it on a daily basis. I seriously recommend you learn the basic shortcuts and give it a go.
This is something all popular Integrated Development Environments have, VS Code, JetBrains IDE's, Atom, Sublime so you can definitely try it out.
Clipboard manager
Now that you know how to copy lines more easily and know how to add a bunch of cursors and copy all the lines at once, you need a better storage place for the data you copied. Instead of overwriting what you copied with each new copy, a clipboard manager enables you to store the data you copy.
Copy from the browser, switch to the IDE to paste, then go back to the browser to copy again, switch to the IDE to paste, go back to... no more!
Copy all the things you need from the browser, switch to your IDE and paste one by one in the desired location.
While on Windows I used Ditto as it has several cool features. On MacOS I use Pastebot which also comes with some advanced features. One of the features I use is Custom Pasteboards where I keep a permanent Lorem Ipsum paragraph which is always useful to have at hand while developing and testing. I also keep my personal Zoom link there as well as it makes setting up meetings on the fly easier. If you find yourself using something over and over again and it might fit into a persistent pasteboard, add it (don't add passwords tho)!
Navigating through the codebase
Use ⌘ + P to quickly open a file.
Don't start looking for the file in the IDEs file Explorer, opening and closing different folders trying to locate it. Or even worse, using the global search to search for something you know is in that file, just to open it. This is something I have witnessed first hand, and usually gets me agitated :)
Pretty much all of the modern editors have this documented in more length. Two main actions follow.
Open a file
You can open any file by its name when you type ⌘ + P (Quick Open). As you start typing the IDE will narrow down the list of files from which you can select to open. You don't have to go to the File Explorer and dig up a file.
Find a symbol or jump to a line
Use ⌘ + P and append @ to find a method inside the file. You can also combine ⌘ + P with @ and/or : to easily jump to methods, variables or jump to lines. I usually use it to jump to a line, especially if I see the line mentioned in the error stack trace.
Jump to definition
Use your mouse keys.
You can jump to definition with ⌘+ Click , but you cannot jump back. Once you jumped in, the only way to go back is to navigate back with ⌘+ - . At that point if you need to see the definition once more, you can just navigate forward using ⌘+ shift + -.
Jumping in several definitions consecutively and then navigating back and forth between them to better understand the data flow in yours or someone else's program is something you have to get familiar with.
The shortcuts here are quite impractical. Of course you can change the shortcuts to your liking. But the neat thing here is that you can also use your mouse to navigate. You just need a mouse with two additional keys which are usually by default bound as navigational keys. You can then use those keys to navigate between the methods in your IDE. And since jumping in requires a mouse click, it feels natural to continue to navigate using the mouse keys.
Even if you don't want to use your mouse keys, do learn the shortcuts or change them as you like. Any of the above is better than navigating back by trying to find the file that you just jumped out of in the list of your currently opened files. The shortcut is a lifesaver here.
These are only bits and pieces I picked up in my own journey that made it a bit more fun, hope it will do the same to you. They might not seem much but as the years go by they will add up.
Top comments (0)