Open a Terminal: CTRL + ~
You could have both Ubuntu (or your favorite CLI) and VS Code open, but why when you don’t have to? CTRL + ~ will open a terminal window, right in VS Code. Clicking the plus symbol in the terminal window will open more terminal windows. This comes in handy when running a backend and a frontend server, while also running GIT commands.
Copy or Cut an Entire Line: CTRL + C/X
Want to reuse a line of code in another place? Place your cursor at the beginning or end of the line in question, and press CTRL + C to copy or CTRL + X to cut the whole line. No highlighting necessary!
Go to File: CTRL + P
Building a Rails app and can’t find your schema file? No problem. CTRL + P will bring up a search bar where you can type in the name of the file you’re looking for. Clicking on a highlighted section will open (or navigate to) that file.
Find & Replace
Looking for a line of code in the file you’re in? CTRL + F will bring up the search function for the current file. Use CTRL + SHIFT + F to search all of the files in the current director. In the search bar you will find options to match case, match whole word, and use regular expressions. CTRL + H will open the find and replace function.
Select All Occurrences
This one can look like magic when you’re watching someone else code. Need to change all occurrences of a specific word- like a variable name? Click the variable or word in question and hold CTRL + SHIFT + L to select all occurrences. Start typing to replace all occurrences with a new word or variable.
Open Next Tab
I almost always code with a minimum of 4 open file tabs. This shortcut will help you navigate all those open tabs without having to use a mouse. CTRL + TAB will open the next tab. CTRL + SHIFT + TAB will open the previous file tab.
Bonus: Color Changes for Easier GIT Commits
I know you all are diligent committers, so you may never need this one. But on the chance that you’re anything like me, and work on more than one file at a time without committing, this one will help you out. Take a look at your left sidebar. Files with changes to be committed, will appear in yellow with an M to the right of the filename. New and untracked files will appear in green with a U. Open a modified file. Changed lines will have a color between the line number and the line itself. Green is for additions, blue for modifications and red for deletions. Commit early and often, but use these context clues for when you forget!
Top comments (0)