Computer

Program like a pro with Visual Studio Code shortcuts

What is Visual Studio Code

Since always, the brand «Visual Studio» It has been considered as an environment created by Microsoft to program all kinds of programs for its own ecosystem (Windows, Server, Azure, etc). This platform has always been exclusive and, moreover, paid (and not exactly cheap). However, in 2015, Microsoft surprised users by creating a new tool under this brand completely free and open source: Visual Studio Code.

VSC is a Cross-platform and multilanguage programming IDE created by Microsoft for all users who need a simple and accessible code editor. This editor is completely free for all users, open source (programmed in Electron and Node.js) and is available for Windows, macOS and Linux.

Among its main characteristics we can highlight that it is a fully customizable editor. As standard we have a very basic functionality, with few more functions than a normal text editor. However, we can extend these features by downloading and installing extensions. These extensions can be found within the program itself and allow us to specialize it in certain languages ​​or add other functions not available as standard. In addition, users can change the theme and colors to suit their tastes or hobbies. We are facing one of the most versatile code editors that we can find.

In addition to all of the above, this program is designed to work with Git (and GitHub, with one of the extensions we just talked about), includes advanced systems of depuration, syntax highlighting, a code auto-completion function, code refactoring functions, etc.

If we don’t have it installed yet, we can download the latest version of the program from the following link. In addition to the stable version, we can also download any of the development versions of the program to have early access to the latest features.

Learning the VSC keyboard shortcuts

All the functions of the program are at our fingertips with the mouse, within its menus. However, depending on what we are doing, taking our hands off the keyboard and going to the mouse, searching and clicking to perform a certain task can be unproductive.

Microsoft has adapted its code editor for ease of use thanks to keyboard shortcuts. A keyboard shortcut is a pre-configured key combination to perform a certain action. These shortcuts can be a single key (for example, the F keys) or a combination of keys, both of which typically use Control or Alt as launchers.

We can find a lot of shortcuts within Visual Studio Code. Some of them allow us to use the basic functions of the program more easily, such as:

  • Ctrl + K + S -> open the list of keyboard shortcuts.
  • Ctrl + Shift + P -> open the command palette.
  • Ctrl +, -> open settings.
  • Ctrl + Shift + X -> change the extensions panel.
  • Ctrl + T -> open the universal quick search panel.
  • Ctrl + N -> open new file.
  • Ctrl + Shift + N -> open new window.
  • Ctrl + F4 -> close file.
  • Ctrl + Shift + W -> close window.
  • F11 -> put in full screen.
  • Ctrl + B -> show or hide the sidebar.

We can also take advantage of these keyboard shortcuts to control usage from the code files. For example:

  • Ctrl + O -> open file.
  • Ctrl + S -> save file.
  • Ctrl + Shift + S -> save file as
  • Ctrl + Shift + T -> open last closed tab.

Visual Studio Code also provides us with a large number of keyboard shortcuts that help us to move around the editor of code to be able to edit it more comfortably. The most important are:

  • Ctrl + C -> copy selection or the line that we have activated at that moment.
  • Ctrl + X -> cut selection or the line that we have activated at that time.
  • Ctrl + V -> paste the contents of the clipboard.
  • Ctrl + Shift + K -> delete line.
  • Home -> go to the beginning of the line.
  • End -> go to the end of the line.
  • Ctrl + Home -> go to the beginning of the file.
  • Ctrl + End -> go to the end of the file.
  • Alt + up / down -> move up or down one line.
  • Ctrl + / -> comment out a line.
  • Shift + Alt + A -> comment out a region.
  • Ctrl +]-> add indentation.
  • Ctrl +[->removeindent[->quitarsangría
  • Ctrl + P -> go to a file.
  • Ctrl + G -> go to a line.
  • Ctrl + T -> show all symbols.
  • Ctrl + Shift + O -> go to a symbol.
  • F8 -> go to the next compiler warning.
  • Shift + F8 -> go to the previous compiler warning.
  • Ctrl + Shift + M -> show the problem panel.
  • Ctrl + -> split editor.
  • Ctrl + 1/2/3 -> open one of the editors.
  • Ctrl + Shift + Avpag -> move editor down.
  • Ctrl + Shift + Repag -> move editor up.

And, of course, VSC will show us a series of keyboard shortcuts that will help us edit the code more easily. Among others, we can highlight:

  • Ctrl + F -> open search panel.
  • Ctrl + H -> open the replace panel.
  • Ctrl + Shift + H -> replace in files.
  • F3 -> find next.
  • Shift + F3 -> search previous.
  • Alt + Enter -> select all matches of the same term.
  • Ctrl + D -> add current selection to search.
  • Ctrl + L -> select current line.
  • Ctrl + Shift + L -> select all lines in the current section.
  • Ctrl + F2 -> select all matches of a current word.
  • Shift + Alt + Right Arrow -> expand selection.
  • Shift + Alt + Left Arrow -> pick selection.
  • Alt + Click -> add cursor.
  • Ctrl + Alt + up / down -> add cursor above or below.
  • Ctrl + U -> undo the last cursor.

Finally, the keyboard shortcut «Ctrl +` »allows us to show the terminal integrated into the program, very useful in debugging tasks.

Some of the keyboard shortcuts that we have just seen may change depending on the operating system that we use. In our case we have put the keyboard shortcuts for Windows, but if we use macOS or Linux, although many will coincide, others (like Ctrl + F4, for example) will be assigned to other keys.

Related Articles