Be a Faster Programmer👩‍💻⏰

Shortcuts and Tips in VS Code

Onali Withanage
LinkIT
5 min readJun 8, 2020

--

Photo by Fernando Hernandez on Unsplash

Hello Everyone!!!

Recently, while I was coding on VS Code I got a question.

Can I increase my Programming Efficiency by limiting Mouse usage?

Do you know the answer?

I searched on the internet and I found a lot of results. So according to the result, I found that the usage of a keyboard instead of a mouse saves a lot of time. Then I decided to try it!!

So in this article, I like to present to you some VS code keyboard shortcuts that might help you.

Try these and you will see how easy is it than using a mouse.

Content

  1. Splitting the editor
  2. Open a file
  3. Search a file/project
  4. Open command Palette
  5. Open/Close Sidebar
  6. Integrated terminal functions (Open, Split, killing, Maximize)
  7. Straight to a given line and come back
  8. Jumping to the beginning and end of a file
  9. Jumping to a Definition
  10. Changing the name of the Symbol
  11. Add multiple cursors
  12. Select/Delete a word
  13. Take a closer look to an error
  14. Close current tab

1. Splitting the editor

Splitting the editor means, in any instance, you can split the editor window in to separate parts. (no limit of how many times you can split the editor) When you write a lengthy program by splitting the editor you can easily edit and view full code on the editor window.

mac ⌘+\

Windows ctrl+\

You can switch among these views by ctrl+1 ( ⌘+1 ) ctrl+2(⌘+2)ctrl+3(⌘+3) and so on….

By using a scroll bar you can go up /down left/right of the view. for this; you can use ctrl+upword arrow ,ctrl+left arrow,ctrl+right arrow,ctrl+downword arrow

Screenshot by Author (split the window into 3 parts)

2. Open a file

There are several ways of opening a file.

  • Search by filename

When you know the file name you can search the file by its name. For this keyboard shortcut is, ctrl+P

Screen Record by Author (Search by file name)
  • Search by texting file name

When you can’t remember the file name exactly but you know some symbols on it then you can use this method to search file. the keyboard shortcut is, ctrl+t

Screenshot by Author (Search by texting file name)
  • open a file inside the system

When you want to open a file which is not in your project directory but from outside you can use ctrl+O

Screenshot by Author (open file a file in system)

3. Search a file/project

You can search in a file by ctrl+F.To search over all files from your currently opened folder you can use Ctrl+Shift+F

4. Open command Palette

In command palette, you can access all the functionality of VS code including keyboard shortcuts for the most common operations. This allows you to access many commands such as navigate a file(ctrl+P), show last opened file set(ctrl+Tab), navigate to specific symbol in a file(ctrl+Shift+O), navigate a specific line in the file(ctrl+G), etc.

You can open command palette by Ctrl+Shift+P

Open command palette and type? it will show all commands you can get from it.

5. Open/Close Sidebar

The sidebar contains different views. When you working on code if you want to display your code in wide space you can remove sidebar by ctrl+B.

You can display sidebar again by pressing ctrl+Bagain.

Screen Record by Author (open and close sidebar)

6. Integrated terminal functions

Integrated terminal use to perform command-line tasks.

open a terminal

You can open a terminal by ctrl+`

splitting a terminal

As we did in the editor, the terminal also can split. we can use the keyboard shortcut ctrl+Shift+5.

killing a terminal

You can kill a terminal by clicking the trash icon on the top-right corner of the terminal. The Keyboard shortcut is ctrl+Shift+X.

maximize a terminal

To maximize the terminal you can use ctrl+Shift+Q

7. Straight to a given line and come back

When you want to go to a specific line you can use ctrl+G

This mostly happens when there is error pointing in a line with a specific index by this command you can jump straight to that line.

After fixing errors we want to fix cursor to where we before work. So you can use ctrl+Uto come back where you were before.

8. Jumping to the beginning and end of a file

go to the beginning of a file

Windows (ctrl+home)

mac (⌘+up)

go to the end of a file

Windows (ctrl+end)

mac (⌘+down)

Screen Record by Author (Go to Start and End of a file)

9. Jumping to a Definition

To get a definition of the selected function, object or a variable you can use f12

10. Changing the name of the Symbol

If we want to change the given name of the symbol in every place it appears in the project we can use f2. Select the symbol and press and rename it.

the new name will apply in every place that symbol appears on the project.

Screen Record by Author (Change symbol name)

11. Add multiple cursors

If we want to write the same thing multiple times you can put multiple cursors.

The keyboard shortcut is f12+left mouseClick

To add multiple cursors below ctrl+alt+down arrow key

To add multiple cursors above ctrl+alt+up arrow key

12. Select/Delete a word

If we want to select a word you can use ctrl+shift+right/left arrow key

To delete a word directly use ctrl+backspace/delete

13. Take a closer look to an error

When there is an error in your code it will show as red underline. To see the error by hover the code we can use the keyboard shortcut F8

Clicking esc you can come back from error mode.

14. Close current tab

To close currently using tab you can use ctrl+W

Screen Record by Author (Tab closing)

If you want to know more refer 👇👇👇👇👇👇👇👇

https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

I hope you enjoyed this article. Please give your opinions and comments, share it with your friends.❤

TRY AND BE A VS CODE NINJA!!!!

GOOD LUCK!!!

--

--

Onali Withanage
LinkIT

Undergraduate at University of Moratuwa.👩‍💻🇱🇰