Post

Speed Up Using Shortcuts (Mac)

Please refer to this post if you are a Windows user.

In this post, I will be sharing why and how I ditched the mouse and started utilising keyboard shortcuts.

Why avoid the mouse?

As a software engineer, efficiency is of the essence, especially when one is dealing with many tasks in his bucket or meeting tight deadlines. For any typing setup, majority of the time is spent moving between the keyboard and mouse. Fortunately for us, we can save this precious time by mastering keyboard shortcuts that can perform the same functions/tasks. Not only do you become more productive, you also get to look really cool (somewhat) and experience what it is like to feel like an experienced hacker (sortof).

It will require some practice to master and apply them properly. But rest assured, once you overcome this steep learning curve, you will witness your productivity drastically increase overtime. Below is a compilation of shortcuts that I have learnt and frequently use on Web browsers, Terminals and VSCode.

Keyboard shortcuts

Basic Shortcuts 
Command + ASelect all
Command + CCopy
Command + FFind keyword
Command + Option + FReplace keyword
Command + QClose application
Command + SSave
Command + VPaste
Command + WClose active window
Command + XCut
Command + ZUndo
Command + `Toggle between application windows
Command + Shift + ZRedo
Command + Ctrl + FFullscreen
Command + Up/DownMove cursor to start/end of document
Command + Left/RightMove cursor to start/end of line
Command + Option + DShow Dock
Command + Option + SpaceOpen Finder
Command + Mission ControlShow/Hide opened apps
Command + Shift + 3Print full screen
Command + Shift + 4Select area and print screen of selected area
Command + Shift + 5Screen recording
Command + Shift + Up/DownSelect all characters from cursor to the top/bottom of the document
Command + Shift + Left/RightSelect all characters left/right of the cursor
Command + Space + Type your searchSystem search
Command + TabToggle applications
Ctrl + UpView all applications from desktop
Shift + Up/DownSelect characters above/below the line
Shift + Left/RightSelect characters left/right of the cursor
Option + Up/DownMove current line above/below it
Option + Left/RightMove cursor to the start/end of words
Browser Shortcuts 
Comamnd + DBookmark current tab
Command + LMove cursor to address bar
Command + RReload page
Command + TOpen new tab
Command + WClose active tab
Command + Shift + TOpen recently closed tab
Command + Shift + WClose all active windows
Command + Left/RightNavigate to previous/next page in history
Control + Tab
Command + Option + Left/Right
Toggle between tabs
F12Open web console
VSCode Shortcuts 
Command + LSelect line
Command + PSearch for file
Command + NWork on a new file
Command + WClose active tab
Command + Shift + FFind keyword in directory
Command + Shift + KDelete line
Command + Shift + POpen command palette
Command + Shift + VPreview Markdown file on the side
Command + Option + Up/DownAdd cursors to multiple lines at the same horizontal positon
Command + Option + Left/RightToggle tabs
Command + \Split code editor/Terminal
Command + /Comment line of code
Ctrl + `Open/close Terminal in code editor
Ctrl + Shift + `Open new Terminal in code editor
Option + Shift + Up/DownCopy and paste current line above/below it
Option + Shift + Left/RightSelect words to the left/right of the cursor
Select keyword + Command + DAdd cursor to all found keywords one at a time
Select keyword + Command + Shift + LAdd cursor to all found keywords
Bash/Terminal Shortcuts 
Command + DSplit Terminal vertically
Command + Shift + DSplit Terminal horizontally
Command + TOpen new Terminal tab
Command + WClose active Terminal tab
Command + Shift + WClose all active Terminal tabs in the same session
Command + Left/RightToggle between Terminal tabs
Command + Option + Up/Down/Left/RightToggle between split Terminals in the same tab
Command + Shift + IBroadcast input to multiple Terminal tabs in the same session (iTerm)
Ctrl + AMove cursor to start of line
Ctrl + EMove cursor to end of line
Ctrl + HClear character before cursor position
Ctrl + DClear character after cursor position
Ctrl + UClear line before cursor position
Ctrl + KClear line after cursor position
Ctrl + L
clear
cls
Clear screen
Ctrl + WDelete previous word
Ctrl + CCancel program
Ctrl + ZStop program
historyShow history of commands
Option + Left/RightMove cursor between words
Up/DownCycle history of commands

Other ways to shortcut your workflow

  1. Learn to touch-type, which incorporates all your fingers to access the keys on your keyboard optimally. With sufficient practice, you will be able to master typing without glancing on the keys, saving time as a result.
  2. Use Tabs for autocompletion in the Terminal, especially when your folder/file names are long/foreign.
  3. When inputing text in multiple input boxes, use Tabs instead of moving the mouse to proceed to the next input.
  4. Use aliases to execute long/complex commands
    Eg. alias nrs=npm run start (Executes npm run start with nrs)
    Eg. alias gps=git push (Executes git push with gps)

  5. Broadcast input to multiple Terminal tabs in the same session if the same executions need to be done on multiple replica servers (You will need to install iTerm2 for this)

Conclusion

Ever since I started learning and using these shortcuts, it was excruciating to realise the amount of time wasted performing repetitive work (Eg. Editing the same variable names repeatedly; Highlighting a block of text; Deleting characters one by one using Backspace). To anyone who is using a computer, ditch the mouse and give these shortcuts a shot. Afterwards, you can reward yourself with a nice coffee break :)

Sources

  1. Keyboard shortcuts for a Developer
  2. 10 Essential Keyboard Shortcuts For Programmers
  3. Bash Shortcuts
  4. Windows vs. Mac: 70+ Common and Helpful Keyboard Shortcuts
  5. Visual Studio Code - Keyboard Shortcuts for Mac
  6. iTerm2
  7. Typing Techniques – 5 Skills to Master
This post is licensed under CC BY 4.0 by the author.