What key shortcuts are to comment and uncomment code?
184383 просмотра
7 ответа
There were Ctrl+E+C (comment) and Ctrl+E+U (uncomment) in older versions, or Ctrl+K+C and Ctrl+K+U.
But in VS 2012, I can't see key shortcuts:
How to enable those shortcuts?
Автор: Dmytro Источник Размещён: 13.11.2019 11:31Ответы (7)
153 плюса
Keyboard accelerators are configurable. You can find out which keyboard accelerators are bound to a command in Tools -> Options
on the Environment -> Keyboard
page.
These commands are named Edit.CommentSelection and Edit.UncommentSelection.
(With my settings, these are bound to Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U. I would guess that these are the defaults, at least in the C++ defaults, but I don't know for sure. The best way to find out is to check your settings.)
Автор: James McNellis Размещён: 22.08.2012 05:2717 плюса
You can also add the toolbar in Visual Studio to have the buttons available.
View > Toolbars > Text Editor
8 плюса
Use the keys CtrlK,C to comment out the line and CtrlK,U to uncomment the line.
Автор: Muhammad Sibtain Arain Размещён: 02.02.2015 11:447 плюса
From your screenshot it appears you have ReSharper installed.
Depending on the key binding options you chose when you installed it, some of your standard shortcuts may now be redirected to ReSharper commands. It's worth checking, for example Ctrl+E, C is used by R# for the code cleanup dialog.
Автор: Richard Banks Размещён: 22.08.2012 06:582 плюса
This is how I did it,
Menu Tools → Options on the Environment → Keyboard window
One can alter the default shortcuts following the below steps
- Select Edit.CommentSelection in the listbox
- Click on "Remove" button
- Select "Text Editor" option in the dropdown under "Use new shortcut in:"
- Press your own shortcut in the textbox under "Press shortcut keys:" Example: Pressing Ctrl+E and then C will give you Ctrl+E, C
- Click on "Assign" button
- Repeat the same for Edit.UnCommentSelection (Ctrl+E, U)
0 плюса
"commentLine" is the name of function you are looking for. This function coment and uncoment with the same keybinding
Автор: UTF2390 Размещён: 11.08.2016 12:470 плюса
I went to menu: Tools → Options.
Environment → Keyboard.
Show command containing and searched: comment
I changed Edit.CommentSelection and assigned Ctrl+/ for commenting.
And I left Ctrl+K then U for the Edit.UncommentSelection.
These could be tweaked to the user's preference as to what key they would prefer for commenting/uncommenting.
Автор: Chris Adams Размещён: 03.04.2017 11:36Вопросы из категории :
- visual-studio Ошибка Visual Studio: непредвиденная задача «GenerateResource»
- visual-studio Какой самый лучший бесплатный детектор утечки памяти для программы на C / C ++ и ее подключаемых библиотек DLL?
- visual-studio программно получить установочный каталог Visual Studio
- visual-studio В чем разница между Build Solution и Batch Build в Visual Studio 2008?
- visual-studio Как заставить Visual Studio заново создать файлы .designer для файлов aspx / ascx?
- visual-studio «Невозможно изменить тип DataType столбца после его получения» в Visual Studio 2005 DataSet Designer
- comments Можно ли использовать комментарии в формате JSON?
- comments Наследование комментариев для C # (фактически любой язык)
- comments Добавление одного и того же комментария к каждому файлу кода в решении Visual Studio
- comments Почему в Python нет многострочных комментариев?
- comments Отображение универсального класса, например Table <String> в комментариях xml в Visual Studio
- comments Возможны ли вложенные комментарии HTML?
- visual-studio-2012 Visual Studio изменить формат даты и времени
- visual-studio-2012 .gitignore для проектов и решений Visual Studio
- visual-studio-2012 Visual Studio При нажатии кнопки «Найти результаты» открывается код в неправильном окне.
- visual-studio-2012 Как запустить .bat изнутри IDE
- visual-studio-2012 Что происходит не так, когда Visual Studio говорит мне «xcopy завершен с кодом 4»
- visual-studio-2012 Asp.net 4.0 не был зарегистрирован