/blog/articles/

Useful VS CODE Keyboard Shortcuts

Over the past couple of weeks I gave Visual Studio Code, the code editor by Microsoft, a try. I didn't use it exclusively but I got a good impression of it. I used it both on macOS and Windows 10. (It's also available for Linux if I'm not mistaken.) Generally I can say it's really good.

But instead of a big review I just wanted to share some keyboard shortcuts I discovered along the way with you.
These are the Windows shortcuts, but generally you just have to substitute ctrl with cmd for the Mac shortcuts.

ctrl + enter: New line below
ctrl + shift + enter: New line above
alt + arrow keys: Move line top/bottom
shift + alt + right arrow: Grow selection to everything inside quotes (sadly doesn't work when cursor is right next to starting quote)
shift + alt + left: Shrink selection
ctrl + enter when opening a file via quick open (ctrl + p): Opens file in new split editor
ctrl +`: Opens integrated terminal
ctrl + b: Show/hide sidebar
ctrl + k ctrl + w: Close all tabs
shift + tab: Unindent line, no matter where in the line the cursor is positioned
ctrl + page down: next editor / next tab
ctrl + page up: previous editor / previous tab
I kinda feel like the last two should be exactly the opposite, but I will keep the default for now and see how it goes. On macOS you can also use cmd + alt + arrow key.

Here you can find an official PDF cheat sheet with a lot of shortcuts: keyboard-shortcuts-windows.pdf

Good way to find keyboard shortcuts

Often times I know what I want to do but don't the shortcut for it, here is a good way to find the key combination: ctrl + shift + p opens command palette with all commands, then you can type what you are looking for, for example "close". You then find all commands that have something to do with closing something and you can see the keyboard shortcut on the right side.

What doesn't work

ctrl + \ should open a new split editor on Windows, but it just doesn't work for me. If I select the command from the menu it works. No idea why.

I hope these commands might help you using VS CODE effectively. Give it a try!

Martin Wolf

Hi, I’m Martin Wolf, a Freelance Frontend Web Developer from Germany.
I believe in hard work and sharing what I know.

Contact me

Interested in working with me? Fantastic! The best way to get in touch is by email (hello@martinwolf.org). I’m looking forward to hearing from you.