React Native

A few keyboard shortcuts I learned that double my productivity

A lot of our work consists of writing and editing text, adding words, copying bits of characters around, and browsing large documents. If only you could be 30% faster at this, imagine how much free time you would get every day. What about getting 50% faster or even twice as fast?

Well, a key to editing text faster is heavily relying on keyboard shortcuts. This is because the shorter your hand has to travel to work, the more work it is able to do. Every back and forth between your trackpad, your mouse and your keyboard cost precious milliseconds and cause a bit of context switching in your brain as you go from moving a cursor around to performing discrete actions and can add up to more than an hour a day.

In this article, I’ll walk you through the most useful keyboard shortcuts, that work on almost every app and can save you time no matter what work you are doing and exist on both Mac and Windows.

General purpose shortcuts

Moving the cursor and text around

I won’t bore you with Command + C and Command + V to copy and paste, or Command + Z and Command + Y to undo and redo, or even Command + F to search around a large chunk of text (With ctrl on Windows).

What really boosted my workflow was when I mistakenly pressed the Ctrl key on my windows laptop while tediously pressing the right arrow to move inside a word.

On Windows, Ctrl allows you to move one word at a time inside a document allowing you to quickly go back to the beginning of the sentence you are typing to have a few edits.

Pressing the shift key while moving allows you to select the text you are moving through to delete or copy it.

Action On Mac On Windows
Select text Arrows + Shift ⇧
Moving one word at a time Arrows + Option ⌥ Arrows + Ctrl ⌃
Moving one line at a time Arrows + Command ⌘ Arrows + Fn 🌐

You can combine shift and the other modifier keys to select large pieces of text very quickly.

By using Command X (Ctrl X on Windows) to cut the current selection, you can easily move whole paragraphs of text with little work.

What is really awesome is that almost every text box on your computer supports these shortcuts: The url bar of your browser, a Word document, your code editor and even the search box in the settings app.

Managing tabs

Most of the software we use has tabs to allow us to work on multiple projects at once. This includes your browser, your code editor or maybe your note-taking app.

These programs use the same usual shortcuts to handle basic operations on tabs.

Action On Mac On Windows
Opening a new tab Command ⌘ + T Ctrl + T
Closing a tab Command ⌘ + W Ctrl + W
Reopening the last closed tab Command ⌘ + Shift ⇧ + T Ctrl + Shift ⇧ + T
Switching tabs Ctrl + Tab
Switching windows Command ⌘ + Tab Windows + Tab

Not all software handles these commands the same way, but most try to provide you with the closest action that exists on that software. For example, VSCode does not have a concept of an empty Tab, so Command T opens a box where you can search for symbols and open a specific file, but Command shift T works as opening a file you just closed exists as a concept inside VSCode.

Going further

Being comfortable using the keyboard is not a state, it is a continuous process. You need to keep on learning new shortcuts as they become useful to stay productive. To discover new shortcuts, you have several options. First, most programs display the keyboard shortcut for each action next to the GUI element, so that the next time you want to perform the same action, you can use the shortcut.

Moreover, a lot of software also supports a “Command Palette” that allows you to access all the features of the software by typing what you want to do, without having to memorize anything.

Usually, the command palette can be accessed using Command + P, like in VSCode or Fork.

On GitHub and other webapps because Command + P is already used to print the current page, the command palette can be accessed using Command + K (or Ctrl + K on Windows). 

Software Keyboard shortcut Action
Github Command ⌘ + K Open command palette
Notion Command ⌘ + K Search for pages
Slack Command ⌘ + K Jump to conversation
Figma Command ⌘ + P Open command palette
VSCode Command ⌘ + P Open command palette

Finally, one last way to learn new shortcuts is to try out keys at random or trying shortcuts from other software. For example, if you try Command + K on Notion, you get access to the search page feature. 

Keybindings for programmers

Vim keybindings

Vim is a text editor written in the 90s that is famous for its steep learning curve and its extremely powerful keybindings. While I would not recommend using Vim by itself, as it does not have all the features of a fully fledged IDE like autocompletion based on an LSP (Try NeoVim for that), many editors like VSCode offer extensions to integrate Vim keybindings into your editor.

Vim allows you to apply very powerful transformations to text as you can see in the video below.

Many people claim that learning Vim really helped them to get their ideas to code quicker. While I’m more of a Sublime Text user and in love with the Sublime Text keybindings, I believe that learning the basic vim keybindings is a great skill to have.

Multiple cursors

Sometimes, you want to type the same thing at different places. In that case, you can use the multi-cursor feature of your editor. Use command + d to spawn a cursor at the next word that matches the one on your current cursor to quickly change a lot of lines at once !

You can also create cursors using command+option+up or down.

This allows you to quickly rename and refactor large sections of repetitive code, for example to modify all the properties of a component to make their type optional or to update a lot of translation keys at once in your app.

Wrapping-up

So, next time you find yourself doing the same action over and over again in any program on your computer, remember to check if there is a keyboard shortcut to help you do it a bit faster!

What matters is to not hesitate to take a bit of extra time to memorize the shortcut and try using it every time when you notice that you use a feature a lot.

If you are interested in becoming more productive in general, check out this great article on managing the tasks in your day to not be overwhelmed.

Développeur mobile ?

Rejoins nos équipes