THESE VS CODE SHORTCUTS HAVE WHOPPING VALUE!

THESE VS CODE SHORTCUTS HAVE WHOPPING VALUE!

Can you imagine how buggered society would be if someone hadn’t invented the microwave? Rustlers would cease to exist for a start, and for some, that is a painful concept to grasp. The very idea of technology is to make our lives more convenient and the VS Code shortcuts I’m going to lay before you do exactly that. Recently, I picked the brains of numerous other developers on LinkedIn and received some superb nominations. I’ve also dropped a few of my personal favorites here too.?

I’m still new to programming but I get the impression that VS Code is the crème-de-la-crème in terms of coding editors. I’ve heard of others mentioned, but the bulk of my experience lies with this one. All I can say for sure is that it looks appealing and is supremely easy to navigate. Using it makes me feel like Indiana Jones armed with Google Maps instead of aged papyrus.?

If you’re even less advanced than me in terms of coding, let me drop a knowledge bomb or two. Visual Studio Code (VS Code) is a popular open-source code editor. It is armed to the teeth with features, extensions, and customization options for developers. VS Code shortcuts are essential tools that can significantly improve your productivity. Think of them as the Stanley knife and half-length pencil to a builder. Not exactly big-boy tools but irritating to be without. Using VS Code shortcuts can help you to complete your coding tasks faster and more efficiently. So without further ado, let’s get tooled up!


  • Move a Line (Alt + Up/Down)

Why would you want to go through the tedious drag of highlighting a block of text, cutting it, then placing the cursor in a specific position and pasting? Moving a line up or down should be a simple process and VS Code makes this so. Just make sure your cursor is on the line you wish to move, hit Alt and an arrow key, and Bob’s your uncle!

  • Double-time coding (Alt + Click)

Photo of coffee-style clock
Photo Credit: Stas Knop from Pexels


Writing the same lines of code over and again must be the bane of most developers’ patience. What if I told you that could be solved in just one click…well, maybe several. By holding down the Alt key and clicking in numerous positions, you are able to type once, yet the code will be written as many times as you wish. This has saved me loads of time during projects.

  • Quick Scrolling (Alt + Scroll Up/Down)

Although I only discovered this handy little beast at the start of 2023, it would be rude to write a VS Code shortcuts guide without including it. Although there is a sidebar in the editor window, it’s so easy to get locked into the habit of scrolling. The problem is, 1000 lines of code takes a while to scroll through. Using Alt + Mouse Scroll together can save you loads of time and misery. It’s like giving your finger a dose of steroids so take it easy on those Red Bulls!

  • Duplicate line (Alt, Shift + Up/Down)

This one has to be something of a no-brainer, really. I mean, nobody makes a single radio button and leaves it there, do they! Duplicate line has gotta be one of the best VS Code shortcuts in my opinion. Moreover, you’re not limited to duplicating single lines of code. Simply highlight any segment - such as a section containing a H2 tag and numerous divs - and hit Alt, Shift and Up/Down until your heart’s content.


Take Full Ctrl of Your VS Code Shortcuts

Image of laptop keboard
Photo Credit: Fernando Arcos from Pexels


If you're worrying that the Ctrl key hasn't been given any exposure so far, then fear not my friend. Here is a small selection that I love and hate the most.

  • Command Palette (Ctrl, Shift + P)

One of the shortcuts I was recommended to use is Ctrl, Shift+P. This opens the Command Palette, where you can search for any command you want. Need to format your code? Just type "format" into the Command Palette and hit enter. Want to toggle the sidebar? Type "sidebar" and hit enter. It's like having a magical genie at your fingertips.Personally, I don’t use this feature too often, albeit, I’m still a beginner and have plenty to learn. I always use this feature to access Emmet (a super useful VS Code add-on) whenever I want to surround segments of code with another section or div.

  • Toggle Sidebar (Ctrl + B)

I have to confess, this particular shortcut gets right on my nerves, especially after too much coffee. However, that’s only because I’m always hitting it accidentally while trying to save files. That being said, its value can’t be denied. The Sidebar in VS Code provides easy access to files, folders, and other resources that you are working with. However, sometimes you might want to focus on the code and hide the Sidebar. Check, check and double check! The shortcut for toggling the Sidebar is Ctrl+B. It will show or hide the sidebar depending on its current state.

  • Go to Line (Ctrl + G)

Sometimes you might need to jump to a specific line in your code quickly. The Go to Line shortcut makes this task easy. The shortcut for Go to Line is Ctrl+G. It opens up a dialog box where you can type the line number you want to jump to. This VS Code shortcut? will take you to that line in a jiffy.

  • Next Occurrence of Text (Ctrl + D)

Another helpful shortcut is? Ctrl + D. This will select the next occurrence of the word that your cursor is currently on. It's like having a personal assistant who reads your mind and knows exactly what you want to select.

  • Begin New Line (Ctrl + Enter)

Hitting Enter whilst the cursor is stuck in the middle of a line means one thing. You’re going to take the remainder of that line with you to the next line. Then you’re forced to go through the trauma of hitting Ctrl + Z, and we all know this VS Code shortcut gets too much attention anyway. It doesn’t stop there either. Once you’ve reversed your actions, you still have to position the cursor at the end of the line so that it plays ball. Thankfully, the Code Gods have put together Ctrl + Enter. This superb VS Code shortcut will take you to a brand-spanking, clean new line regardless of where the cursor currently resides. And here’s a Brucey bonus; Ctrl, Shift + Enter will create a clean new line above your current line.

  • Keyboard Shortcuts Menu (Ctrl + K, Ctrl + S )

Ok, I’m wondering if this one makes me the laziest blogger in tech. Or maybe I’m writing myself out of a promising side hustle. Wit and charm will only get a geezer so far. Anyway, this shortcut brings up the VS Code Shortcuts menu, where you can customize your shortcuts. Be warned, though, there are hundreds of these beasts to get through so have a bucket of coffee at the ready. But let's be honest, if you're using this shortcut, you're probably just trying to show off how many shortcuts you know.


Enough VS Code Shortcuts for One Day

No alt text provided for this image
Photo Credit: Andrea Piacquadio from Pexels


Well that’s it from me. I thought ten would be a nice round number so I hope they’ve scratched any itch you might have had. Moreover, I’ve tried my best to avoid contaminating this article with the usual 5 VS Code shortcuts you’re likely to see elsewhere. The fun thing is, I have discovered one or two of my entries by accident. Toggle Sidebar (Ctrl + B) for example was an unwelcome discovery and it still gets right on my nerves. One day, I will perform surgery on my laptop and feed the B-key to my bin. That being said, everyone is different and I can imagine that many people would love this feature.?


Should you have any more exciting and useful VS Code shortcuts to share, please don’t hesitate to comment below. I’m quite certain that I can learn more from you than you’ve learned here so please don’t be shy. For now, this is Steven Brooks (and his annoying B-key) signing off!


Bikash K C

Software engineer | Crafting Solutions for a Better Tomorrow

1 年

Good one Steven ?? !! You were right. The last one really did surprise me and might save me from Google searches. A lot to explore there. Another interesting thing, my favorite "Ctrl + /" did not make the cut.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了