10 Essential Keyboard Shortcuts For Programmers

Web Dev Simplified · Beginner ·💻 AI-Assisted Coding ·7y ago

Key Takeaways

Explores 10 essential keyboard shortcuts for programmers to enhance efficiency in their editor or IDE of choice

Full Transcript

Hello everybody. Kyle here from WebDevSimplified. We make the web easy to understand and accessible for everyone. Now, if you're anything like me, you sit in front of a computer most of your day coding away in your favorite text editor. And in order to make this a more enjoyable and efficient experience, it's important that you make sure you know the most important keyboard shortcuts in order to save the most amount of time while editing. This is why I'm going to go over the 10 most important keyboard shortcuts that every programmer should know because I've seen far too many people not know these simple commands which would save them hours of time over their lifetime. So, let's get started now. Before we get started, I want to preface this video by saying that if you are an experienced programmer, then you may already know all the shortcuts on this list. I would still recommend watching because there may be one or two that you are not familiar with, but just be aware that you will probably know most of the items on this list. And I have them all linked in the description below, so you can jump directly to the ones that you don't know and skip over the ones you do know. I also want to mention that while these are very common keyboard shortcuts, they may not work in every single editor. I've tested them in most modern editors, so you shouldn't have to worry about using them in editors such as Visual Studio Code, Atom, Sublime, etc., but there may be certain editors or IDEs that they don't work in. And in that case, I would just recommend looking at the settings for that editor, and it will tell you exactly what the keybinding is because all of these shortcuts are in these editors. They just may have a slightly different keybinding. Also, all the keybindings that I list are going to be for Windows. So, if you're using a Mac, just make sure to swap out control with command, and all of these will work for you. The first shortcut that I want to talk about is definitely the easiest one and one that you probably the most familiar with, and that's copy, cut, and paste but in a way that you may not I'll used to using it. As you all probably know, you can use control C to copy something that you've highlighted. You can then use control V to paste that thing that you highlighted. And then you can also use control X, which will cut what you've highlighted and allow you to paste it just like copy. But what you may not know is that if you have nothing highlighted and you just have your cursor on a line and you click control C to copy something like this, and then when you go to paste it, it'll paste that entire line including the line break. So if I go down here and I hit control V, it'll paste that entire line and it'll paste it in the line directly above wherever your cursor is. It works the same with control X. So if I hit control X, it cuts out that entire line, line break and all. And then I can paste it down later just like that with control V. The next shortcut that I want to talk about is one that I use every single day and that's a way to easily comment and uncomment lines of code. For example, if you're debugging something or just running an application and wanting to swap out certain parts of code quickly, an easy way to do that is to comment out the lines. But it kind of sucks having to go in and write comments on all the lines or surround it by a block comment. So an easy way to fix this is just highlight whatever code you want to comment and click control and then the forward slash and it'll comment all the lines that you've highlighted. And then all you need to do is re-highlight that, hit the same command, control and forward slash, and it'll uncomment all the lines that are commented. This is an amazingly useful command that I use all the time while programming. The next command is control P, which will allow you to search for a file inside of your project. So as you can see on the left here, I have a few files in my project. And if I hit control P, I get a search bar that allows me to search my files by name. So if I wanted to find my index.html, I just type in index.html. If I hit enter, it'll open up that file for me inside of my editor. This is incredibly useful when you want to go through all the different files inside of your project and easily swap between them without having to search through all the different folders that you have inside of your sidebar. The next shortcut is another one that you guys probably have already used before and that's control F and control shift F. So control F lets you do a find inside of whatever file you have open. So if I hit control F and I search for assets for example, you can see it highlights all the different assets that I have inside of this file. If I click enter, it'll allow me to cycle through the different assets and all of the words that match that and I could search for something else. For example, I could search for this variable background music and if I enter, you'll see I'll cycle through all those different variable names. So that's incredibly useful. And then if you want to search throughout your entire project, you can use control shift F which will open up a search bar over here and if I search for assets for example over here, it'll show me all the different files where I've used that word assets and it'll allow me to just click on it and go exactly to that line in that file, which is incredibly useful. Another amazing extension that saves me tons of time is the ability to indent and unindent multiple lines at a time. So for example, if I wanted to indent these three lines one indentation further, all I would do is highlight them and then click tab and it will indent all of those lines by one tab. I could do this as many times as I want, but if I want to unindent it, I just hold down shift and click tab again and that'll do the exact opposite and unindent it by one tab every single time that I click it. The next shortcut may not be the most useful in larger projects where you want to specifically say where you need your files to go, but when you need to just create a new file quickly, you can just hit control N and it'll open up a brand new file for you that you can then save and designate where you want to save to. This next shortcut is incredibly useful when you need to change things inside of a line while writing code. For example, if I wanted to change this to be asset instead of assets, I'd go in here, delete asset, and then if I wanted to add a new line after it, normally I would have to arrow over or click on the end of the line and then click enter to get to the next line. But, if I'm over in the middle of my line here and I want to create a new line, all I can do is hit control and enter and it'll automatically create a new line and put my cursor on it, no matter where my cursor is in the line above it. Arguably, the most important keyboard shortcut on this list is probably one of the simplest, and that's using control plus one of the arrow keys. This allows you to jump ahead an entire word at a time as opposed to one character at a time. As you can see, my cursor is slowly moving to the right here as I click, and I can move it to the left one word at a time if I hit the left arrow key. And this is incredibly useful for when you want to navigate across your project, or even if you want to delete a whole word at once. If you hit control and then hit backspace, for example, you'll delete that entire word as opposed to just a single character. You can also combine this with our next shortcut, which is holding down shift and the arrow key to highlight things one character at a time. And if you hold down control, it'll do this one word at a time as opposed to one character at a time. And as long as you just keep that shift key held down, it'll highlight everything that you want. So, you can highlight specific things, delete them as you need for whatever your purposes are. And we finally got to the last shortcut on our list, which is actually a collection of three different shortcuts that are all very simple to use and you probably already know them, but they're incredibly useful when you're programming. The first one is my favorite shortcut, which I literally use all the time. It's just a habit right now, and that is control S in order to save your file. I all the time, as I'm writing different code, will just hit control S every single time I stop coding just to make sure I have everything saved. It's a habit of mine and it's incredibly useful in case your computer dies or your text editor closes without something being saved. You You have your code saved, which is incredibly useful. The next shortcut is control A, which allows you to highlight everything inside of a file at once. So, if I hit control A, you'll see that it selects all the text inside of my file. I could delete it, for example, to remove everything in that file, which is the most common use case I use for control A, or I use it in order to copy an entire file, which I also use all the time. And as you saw there, the next set of shortcuts is the undo key, which is control Z. So, control Z allows me to undo something. So, if I delete this, I can just hit control Z, and it'll undo that and allow me to have everything as it was. And then the reverse of that is going to be control shift Z, which allows you to redo something that you've undone. Some text editors will have control Y be the undo key. So, you'll just have to make sure and see which one it is in your text editor. I'm using Visual Studio Code, where you can use either control Z, control shift Z, or control Y. So, if I put this here and I use control Y, you'll see it undoes it, or if I use control shift Z, it undoes it as well. So, it really depends on the editor that you're using. And that's really all of the essential shortcuts that you need to know. I'm going to go over a quick recap of all the shortcuts that we've covered, so that you make sure you have all of them in your memory. The first one is to be able to cut, copy, and paste lines at a time by not highlighting anything, and that's using control C for copy, control X for cut, and control V for paste. The next thing that we talked about was using control plus the forward slash in order to comment out any code that you've highlighted or the line that your cursor is on, and that allows you to comment and uncomment. So, it essentially works as a toggle, which is incredibly useful. The next thing that we talked about is using control P to search for a file by name that's inside of your project. And then we went on and we talked about using control F and control shift F to search for either inside of your file with control F or inside of your entire project using control shift F. We then went on and talked about using tab and shift tab in order to indent and unindent entire lines or entire highlighted sections of code all at once, which makes formatting your code much easier. Then we talked about using control N to create new files quickly without having to go into your editor and click where you want the file to be created. Then control enter allows you to create a new line that's below whatever line your cursor is without actually mattering where your cursor is inside of the line, whether it's in the middle of the line, beginning of the line, end of the line, it always creates a new line that's completely blank for you after the line your cursor's on. Then we talked about using control plus the arrow keys in order to move entire words at a time and shift plus the arrow keys in order to be able to highlight single characters or words if we combine it with control while we use shift and the arrow keys. And then lastly, we talked about three shortcuts, control A to highlight every single thing in an entire file, control S to save the current file that you have open, and then control Z to undo, and control shift Z or control Y to redo whatever you've undone. So I really hope you guys enjoyed this quick video about the different shortcuts that are incredibly useful and will save you tons of time over your career as a programmer. If you did enjoy it, please make sure to leave a like down below so that I know you're enjoying the content and let me know down in the comments below what shortcuts that you think that I've missed. I want to make a follow-up video to this in the future going over Visual Studio Code specific shortcuts. So if you're interested in that as well, please let me know down in the comments below. Thank you guys very much for watching and have a good day.

Original Description

As a programmer we spend most of our day in front of a computer, and the majority of that time is spent in our favorite editor/IDE. Because of this, it is crucial that we are as efficient as possible in our editor of choice. This is where keyboard shortcuts come in. Knowing the proper keyboard shortcuts for each situation will save you time and make programming more enjoyable. In this video I will be going over the 10 most commonly used keyboard shortcuts that every programmer should know. If you feel I missed any shortcuts please let me know down in the comments below. Keyboard Shortcuts Article: https://blog.webdevsimplified.com/2020-08/10-best-keyboard-shortcuts [0:00] - Introduction 01. [01:45] - (Ctrl + C) Copy/(Ctrl + X) Cut/(Ctrl + V) Paste Whole Lines 02. [02:44] - (Ctrl + /) Toggle Comment on Highlighted Lines 03. [03:29] - (Ctrl + P) Open File Within Project By Name 04. [04:00] - (Ctrl + F) Find In File, (Ctrl + Shift + F) Find In Project 05. [04:51] - (Tab) Indent Highlighted Lines, (Shift + Tab) Unindent Highlighted Lines 06. [05:20] - (Ctrl + N) Create New File 07. [05:36] - (Ctrl + Enter) Create New Line Below Current Line Independent of Cursor Position 08. [06:10] - (Ctrl + Left/Right Arrow) Move Cursor Whole Words At A Time 09. [06:45] - (Shift + Left/Right Arrow) Highlight Characters With Arrow Keys 10. [07:04] - (Ctrl + S) Save File, (Ctrl + A) Select All, (Ctrl + Z) Undo, (Ctrl + Shift + Z)/(Ctrl + Y) Redo 08:47 - Recap of all Shortcuts Twitter: https://twitter.com/DevSimplified GitHub: https://github.com/WebDevSimplified CodePen: https://codepen.io/WebDevSimplified #KeyboardShortcuts #Programming #VSCode
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Web Dev Simplified · Web Dev Simplified · 31 of 60

1 Introduction to Web Development || Setup || Part 1
Introduction to Web Development || Setup || Part 1
Web Dev Simplified
2 Introduction to Web Development || Understanding the Web || Part 2
Introduction to Web Development || Understanding the Web || Part 2
Web Dev Simplified
3 Introduction to HTML || Your First Web Page || Part 1
Introduction to HTML || Your First Web Page || Part 1
Web Dev Simplified
4 Introduction to HTML || Basic HTML Elements || Part 2
Introduction to HTML || Basic HTML Elements || Part 2
Web Dev Simplified
5 Introduction to HTML || Advanced HTML Elements || Part 3
Introduction to HTML || Advanced HTML Elements || Part 3
Web Dev Simplified
6 Introduction to HTML || Links and Inputs || Part 4
Introduction to HTML || Links and Inputs || Part 4
Web Dev Simplified
7 Learn Git in 20 Minutes
Learn Git in 20 Minutes
Web Dev Simplified
8 5 Must Know Sites For Web Developers
5 Must Know Sites For Web Developers
Web Dev Simplified
9 10 Best Visual Studio Code Extensions
10 Best Visual Studio Code Extensions
Web Dev Simplified
10 Learn CSS in 20 Minutes
Learn CSS in 20 Minutes
Web Dev Simplified
11 How to Style a Modern Website (Part One)
How to Style a Modern Website (Part One)
Web Dev Simplified
12 How to Style a Modern Website (Part Two)
How to Style a Modern Website (Part Two)
Web Dev Simplified
13 3D Flip Button Tutorial
3D Flip Button Tutorial
Web Dev Simplified
14 How to Style a Modern Website (Part Three)
How to Style a Modern Website (Part Three)
Web Dev Simplified
15 Animated Loading Spinner Tutorial
Animated Loading Spinner Tutorial
Web Dev Simplified
16 How to Write the Perfect Developer Resume
How to Write the Perfect Developer Resume
Web Dev Simplified
17 Animated Text Reveal Tutorial
Animated Text Reveal Tutorial
Web Dev Simplified
18 Learn Flexbox in 15 Minutes
Learn Flexbox in 15 Minutes
Web Dev Simplified
19 Custom Checkbox Tutorial
Custom Checkbox Tutorial
Web Dev Simplified
20 Start Contributing to Open Source (Hacktoberfest)
Start Contributing to Open Source (Hacktoberfest)
Web Dev Simplified
21 JavaScript Shopping Cart Tutorial for Beginners
JavaScript Shopping Cart Tutorial for Beginners
Web Dev Simplified
22 Responsive Video Background Tutorial
Responsive Video Background Tutorial
Web Dev Simplified
23 1,000 Subscriber Giveaway
1,000 Subscriber Giveaway
Web Dev Simplified
24 How To Prevent The Most Common Cross Site Scripting Attack
How To Prevent The Most Common Cross Site Scripting Attack
Web Dev Simplified
25 Transparent Login Form Tutorial
Transparent Login Form Tutorial
Web Dev Simplified
26 The Forgotten CSS Position
The Forgotten CSS Position
Web Dev Simplified
27 How to Code a Card Matching Game
How to Code a Card Matching Game
Web Dev Simplified
28 10 Must Install Visual Studio Code Extensions
10 Must Install Visual Studio Code Extensions
Web Dev Simplified
29 Learn CSS Grid in 20 Minutes
Learn CSS Grid in 20 Minutes
Web Dev Simplified
30 Learn JSON in 10 Minutes
Learn JSON in 10 Minutes
Web Dev Simplified
10 Essential Keyboard Shortcuts For Programmers
10 Essential Keyboard Shortcuts For Programmers
Web Dev Simplified
32 What Is The Fastest Way To Load JavaScript
What Is The Fastest Way To Load JavaScript
Web Dev Simplified
33 Differences Between Var, Let, and Const
Differences Between Var, Let, and Const
Web Dev Simplified
34 How To Install MySQL (Server and Workbench)
How To Install MySQL (Server and Workbench)
Web Dev Simplified
35 Learn SQL In 60 Minutes
Learn SQL In 60 Minutes
Web Dev Simplified
36 How To Solve SQL Problems
How To Solve SQL Problems
Web Dev Simplified
37 What Are Design Patterns?
What Are Design Patterns?
Web Dev Simplified
38 Null Object Pattern - Design Patterns
Null Object Pattern - Design Patterns
Web Dev Simplified
39 Your First Node.js Web Server
Your First Node.js Web Server
Web Dev Simplified
40 How To Setup Payments With Node.js And Stripe
How To Setup Payments With Node.js And Stripe
Web Dev Simplified
41 How To Learn Any New Programming Skill Fast
How To Learn Any New Programming Skill Fast
Web Dev Simplified
42 Asynchronous Vs Synchronous Programming
Asynchronous Vs Synchronous Programming
Web Dev Simplified
43 JavaScript ES6 Arrow Functions Tutorial
JavaScript ES6 Arrow Functions Tutorial
Web Dev Simplified
44 Are You Too Old To Learn Programming?
Are You Too Old To Learn Programming?
Web Dev Simplified
45 JavaScript Cookies vs Local Storage vs Session Storage
JavaScript Cookies vs Local Storage vs Session Storage
Web Dev Simplified
46 JavaScript Promises In 10 Minutes
JavaScript Promises In 10 Minutes
Web Dev Simplified
47 Builder Pattern - Design Patterns
Builder Pattern - Design Patterns
Web Dev Simplified
48 JavaScript == VS ===
JavaScript == VS ===
Web Dev Simplified
49 JavaScript ES6 Modules
JavaScript ES6 Modules
Web Dev Simplified
50 8 Must Know JavaScript Array Methods
8 Must Know JavaScript Array Methods
Web Dev Simplified
51 CSS Variables Tutorial
CSS Variables Tutorial
Web Dev Simplified
52 JavaScript Async Await
JavaScript Async Await
Web Dev Simplified
53 How To Choose Your First Programming Language
How To Choose Your First Programming Language
Web Dev Simplified
54 Easiest Way To Work With Web Fonts
Easiest Way To Work With Web Fonts
Web Dev Simplified
55 Singleton Pattern - Design Patterns
Singleton Pattern - Design Patterns
Web Dev Simplified
56 Responsive Navbar Tutorial
Responsive Navbar Tutorial
Web Dev Simplified
57 CSS Progress Bar Tutorial
CSS Progress Bar Tutorial
Web Dev Simplified
58 Learn GraphQL In 40 Minutes
Learn GraphQL In 40 Minutes
Web Dev Simplified
59 What is an API?
What is an API?
Web Dev Simplified
60 Learn How To Build A Website In 1 Hour!
Learn How To Build A Website In 1 Hour!
Web Dev Simplified

Related Reads

Up next
Chromebooks for Coding - Are they worth it?!
Adrian Twarog
Watch →