Take shortcuts! On your keyboard… Where did your mind go?
Keyboard short cuts for your Mac and the terminal
In everyday life, cutting corners and taking shortcuts across Mrs. Smith’s lawn, are frowned upon. But on the keyboard, the faster your fingers move coupled with decreased excess movements, amounts to more time gained. With a unanimous vote, we can all agree that saving time on work and school assignments can be chalked up to a win.
Shift ⇧ + up arrow/down arrow: HIGHLIGHTS entire lines of code in that direction.
Shift ⇧ + Option ⌥ + down arrow: When code is highlighted, it COPIES complete chunks of code. If there is not code highlighted, it will just copy down that specific line.
Shift ⇧ + tab: INDENTS code to the left(the opposite of regular tab)
Option ⌥ + up arrow/down arrow: MOVES code up and down the page. It either moves one line or an entire chunk of highlighted code.
Command ⌘ + D: Whenever there is symbol/word/phrase highlighted, it will highlight the next item that matches your first highlighted item. If there is nothing that matches, it will not continue to highlight.
Control + ~: OPENS the terminal in VS Code.
Command ⌘ + Shift ⇧ + Z: REDO
Command ⌘ + X: CUTS entire line of code if there are no highlights. Then can be pasted wherever.
Command ⌘ + Option ⌥ + S: Allows you to SAVE ALL files at once.
Command ⌘ + A: Copies ENTIRE page
Above are the keyboard shortcuts I find the most useful. The next section will outline commands that are most useful for navigating a terminal. Using the keyboard commands below, you will never have to reach for the mouse.
Command ⌘ + space bar will open up the spotlight search and allow you to search for your iTerm so you do not even have to leave the keyboard to find your terminal.
mkdir folder_name: Creates a new directory
take folder_name: Creates and puts you inside the new directory
touch file_name: Creates a new file name when you are inside of a directory
cd directory or file_name: Takes you inside of that directory or file
code .: Opens the current file or directory in VS Code
../: Takes you up a directory
ls: Will give a list of all of the files inside of a directory
ls -a: Shows a list of all files including the hidden ones
rm -f file_name: Permanently deletes the file
Take your time and become familiar with these keyboard shortcuts. They will save you a lot of time and allow you to move more smoothly through your code. Trust me! You will not regret this. Until next time, happy coding!