Что может Ctrl в Visual Studio
Одна простая клавиша Ctrl может значительно упростить работу в Visual Studio. Помимо типичных комбинаций, которые нам очень хорошо знакомы, существует также и большое количество других, менее известных, но от этого и более ценных.
Далее список того, что можно делать с клавишей Ctrl.
Редактирование и печать:
Ctrl+C, Ctrl+V, Ctrl+X, Ctrl+S — самое очевидное
Ctrl+P — мало ли, вдруг кому-то захочется распечатать свой код
Ctrl+Del, Ctrl+Backspace — удаление слова справа от курсора, слева от курсора
Ctrl+Enter, Ctrl+Shift+Enter — добавление строки над текущей, под текущей
Ctrl+J — завершение ввода выражения
Ctrl+U — перевод символа перед курсором в нижний регистр
Ctrl+Shift+U — перевод символа перед курсором в верхний регистр
Ctrl+= — выделение кода до предыдущего положения курсора
Ctrl+Left, Ctrl+Right — переход к предыдущему слову, следующему
Ctrl+Shift+Left, Ctrl+Shift+Right — выделение слова слева от курсора, справа от курсора
Ctrl+K, Ctrl+C(комбинация) — закомментирование строки
Ctrl+K, Ctrl+U(комбинация) — раскомментирование строки
Поиск и навигация:
Ctrl+F, Ctrl+Shift+F — поиск в документе, поиск в файлах
Ctrl+H, Ctrl+Shift+H — поиск с заменой в документе, поиск с заменой в файлах
Ctrl+F3, Ctrl+Shift+F3 — поиск выделенного текста в прямом и обратном направлениях
Ctrl+F4 — закрытие текущего окна
Ctrl+F6, Ctrl+Shift+F6 — переход к следующему окну, предыдущему(по принципу последний использовавшийся)
Ctrl+Tab, Ctrl+Shift+Tab — тот же эффект, только с отображением окон
Ctrl+Alt+Up, Ctrl+Alt+Down — выпадающий список открытых окон
Ctrl+- — переход к предыдущему положению курсора
— на панели инструментов
Ctrl+Up, Ctrl+Down — переход к следующей группе инструментов, предыдущей
Ctrl+PageUp, Ctrl+PageDown — переход к следующему окну, предыдущему
Компиляция и отладка:
Ctrl+F5 — запуск без отладки
Ctrl+Shift+B — сбилдить решение
Ctrl+D, Ctrl+E(комбинация) — список исключений при отладке
Ctrl+Shift+F9 — удалить все брейкпоинты
Ctrl+R, Ctrl+M(комбинация) — выделение метода
Ctrl+R, Ctrl+E(комбинация) — инкапсуляция метода
Ctrl+R, Ctrl+I(комбинация) — выделение интерфейса
Ctrl+R, Ctrl+V(комбинация) — удаление параметра
Ctrl+R, Ctrl+O(комбинация) — изменить порядок параметров
Ctrl+I — превращает курсор в бинокль, который при наведении на объект, выдает всплывающую подсказку о нем
Ctrl+Space — вывод подсказок IntelliSense
Ctrl+Alt+A — открытие командной строки
Ctrl+K, Ctrl+I(комбинация) — всплывающие подсказки
Ctrl+K, Ctrl+X(комбинация) — вставка шаблонов
Ctrl+K, Ctrl+F(комбинация) — форматирование выделенного текста
Ctrl+Alt+Space — вывод параметров функции при наборе
Ctrl+Shift+A — добавить новые item
— закладки(все в комбинации)
Ctrl+K, Ctrl+K — установить закладку
Ctrl+K, Ctrl+N — переход к следующей закладке
Ctrl+K, Ctrl+P — возврат к предыдущей закладке
Ctrl+K, Ctrl+L — удалить все закладки
И наконец, мое самое любимое — Ctrl+’.'(плюс точка на латинице)
Самая часто встречающаяся неточность — попытка использовать какой-то класс, который еще не создан, либо который не был подключен. Именно для этого и существует комбинация Ctrl+. Достаточно нажать после имени класса, как всплывающее окно предложит либо заинклюдить необходимую библиотеку, либо создать новый класс.
На этом, пожалуй, список завершен. Просьба сообщить, если что-то важное было упущено, да и неважное тоже.
How to comment multiple lines in Visual Studio Code?
I cannot find a way to comment and uncomment multiple lines of code in Visual Studio Code.
Is it possible to comment and uncomment multiple lines in Visual Studio Code using some shortcut? If yes, how to do it?
40 Answers 40
Windows: Shift + Alt + A
Linux: Shift + Ctrl + A
Here you can find all the keyboard shortcuts:
PS: I prefer Ctrl + Shift + / for toggling block comments because Ctrl + / is shortcut for toggling line comments so it’s naturally easier to remember. To do so, just click on the settings icon in the bottom left of the screen and click ‘Keyboard Shortcuts’ and find "toggle block. ". Then click and enter your desired combination.
![]()
First, select the lines you want to comment/uncomment ( CTRL + L is convenient to select a few lines)
To toggle line comments, execute editor.action.commentLine ( CTRL + / on Windows)
or
To add line comments, execute editor.action.addCommentLine ( CTRL + K CTRL + C )
To remove line comments, execute editor.action.removeCommentLine ( CTRL + K CTRL + U )
or
To toggle a block comment, execute editor.action.blockComment ( SHIFT — ALT — A )
![]()
How to comment out multiline / single line in VS Code:
MacOS:
Shift + Option + A :
Windows:
How to remap / change these shortcuts?
Windows: File > Preferences > Keyboard Shortcuts.
MacOS: Code > Preferences > Keyboard Shortcuts.
You can search through the list both by keybindings (key names) and command names.
The keyboard shortcut to comment multiple in Windows is shift + alt + A .
In my case, Ubuntu, the shortcut is ctrl + shift + A .
![]()
You can see all available keybindings on the official documentation.
Here’s the relevant bit for osx:
You will need to select the lines you want to comment first, then execute above shortcut, i.e. ⌘/ on osx Ctrl/ on Windows.
In MacOS comment out multi-lines in Visual Studio Code by keyboard shortcut:
Option + Shift + A
Select all lines and then press CTRL + /
Try option 1 first. If it doesn’t work for you then try option 2 which is the actual shortcut for VS Code:
Option 1. Alt / Option + Shift + A
Option 2. While the text is selected hit Ctrl / Cmd + K and then Ctrl / Cmd + C .
As of now (version 1.16.3), you can check all available keyboard shortcuts by going into File > Preferences > Keyboard shortcuts. Here you can search for shortcuts related to code comments.
For users who are coming from Sublime Text or likes to have Ctrl + Shift + / , you can make the change from the above mentioned settings panel or simply install the Sublime Text Keymap extension by Microsoft.
Update: As VS Code has become pretty much standard editor for almost everything these days, I would say picking option 1 is always helpful.
Show comment and uncomment in Visual Studio 2019

In this post, we will learn what’s shortcut key for comment and uncomment in Visual Studio as well as we’ll explain how to show comment and uncomment in Visual Studio Toolbar.
- 1 Missing comment and uncomment in Visual Studio 2019
- 1.1 Show comment and uncomment in Visual Studio 2019
- 2.1 Shortcut key for comment in Visual Studio 2019
- 2.2 Shortcut key for uncomment in Visual Studio 2019
Applies To
- Visual Studio 2019.
- Visual Studio 2017.
- Visual Studio 2015.
- Visual Studio 2013.
Missing comment and uncomment in Visual Studio 2019
I have opened Visual Studio, and I had noticed that the comment and uncomment button box is not shown in Visual studio toolbar as displayed below:

I would like to show comment and uncomment button to be like below:

Show comment and uncomment in Visual Studio 2019
In Visual Studio, the comment and uncomment buttons are included in the Text Editor option, and Visual Studio 2012 (and maybe later versions) does not add the Text Editor option in the Visual Studio toolbar by default.
So to show comment and uncomment in Visual Studio, you should enable Text Editor option by doing the following:
- Click right on any free space in the Visual Studio toolbar, then select “Text Editor”.

- The below buttons should be added to Visual Studio toolbar!


- In old Visual studio versions like Visual Studio 2008 / 2010, the comment and uncomment icons look like the below.

Shortcut key for comment and uncomment in Visual Studio 2019
Besides the comment and uncomment button in Visual Studio toolbar, you can also use the keyboard shortcuts to perform the same actions
Shortcut key for comment in Visual Studio 2019
- Select the piece of code that you would like to comment on.
- Then click CTRL + K + C to apply comment on the selected code.

Shortcut key for uncomment in Visual Studio 2019
- Select the piece of code that you would like to uncomment.
- Then click CTRL + K + U to uncomment.

Conclusion
If the Text Editor is not enabled in Visual Studio, you will not be able to find the comment and uncomment in Visual Studio. so here, we have tried to show these buttons in the Visual Studio toolbar. Also, we have provided the Keyboard Shortcut key for comment and uncomment in Visual Studio 2019.
How to comment multiple lines in Visual Studio (VS) Code
In previous article, I have mentioned Useful Visual Studio Shortcuts (comment, remove comment, Collapse code etc ) but in this article, I have mentioned how to comment out multiple lines in Visual Studio Code.
Comment out multiple lines of selected code
Method:1
- If the file is already opened in Visual Studio Code. Select a block of code using your mouse or keyboard
- Then you can simply click on «Alt+Shift+A» in Windows or «Ctrl + Shift +A» in Mac to comment or uncomment selected lines, as you can see in given image
- On Ubuntu, the shortcut is Ctrl + Shift + A, similar to Mac.
Method 2:
In Windows
You can also CTRL + K and then CTRL + C to comment multiple lines
For uncommenting multiple lines you can use CTRL + K then CTRL + U
On Mac
You can use CMD + K + C to comment multiple lines
CMD + K + U to uncomment multiple lines.
Method 3:
Simply use ‘Ctrl + /’ for commenting and uncommenting code in VS Code Windows and To toggle a block comment, execute editor.action.blockComment (SHIFT + ALT + A)
On Mac, the shortcut is: Command + /
Usually, as you can see from above shortcuts in VS Code comment shortcuts, Mac is very similar to the Windows version.
Changing the comment shortcut in VS Code
You can also customise the comment shortcuts in VS Code.
- Windows : File -> Preferences -> Keyboard Shortcuts.
- MacOS : Code -> Preferences -> Keyboard Shortcuts.
You can search through the list both by keybindings (key names) and command names, and update them according to what you like.
Format code shortcut in VS Code
I would like to mention another useful shortcut for VS Code, which is to format code: