Python comment multiple lines shortcut vscode
I cannot find a way to comment and uncomment multiple lines of code in Visual Studio Code. Show Is it possible to comment and uncomment multiple lines in Visual Studio Code using some shortcut? If yes, how to do it?
Gama11 29.2k9 gold badges69 silver badges93 bronze badges asked Dec 16, 2015 at 15:40
2 Windows: Shift+Alt+A Linux: Shift+Ctrl+A Here you can find all the keyboard shortcuts: Windows VSCode Shortcuts Linux VSCode 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.
Nomnom 3,3344 gold badges26 silver badges33 bronze badges answered Apr 10, 2018 at 9:00
saran3hsaran3h 10.9k3 gold badges33 silver badges47 bronze badges 11
First, select the lines you want to comment/uncomment (CTRL+L is convenient to select a few lines) Then:
See the official doc : Key Bindings for Visual Studio Code
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Dec 16, 2015 at 16:21
WosiWosi 38.7k15 gold badges74 silver badges77 bronze badges 10 How to comment out multiline / single line in VS Code: MacOS:Shift + Option + A:
CMD + /:
Windows:Shift + Alt + A:
CTRL + /:
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. Read: How to set shortcuts from another text editor (Sublime, Atom etc)? Official docs: Key Bindings for Visual Studio Code answered Dec 26, 2017 at 19:04
EduardEduard 7,5088 gold badges38 silver badges63 bronze badges 3 The keyboard shortcut to comment multiple in Windows is shift+alt+A.
nbro 14.3k27 gold badges104 silver badges188 bronze badges answered Jul 28, 2016 at 6:57
Abdu RahimanAbdu Rahiman 1,3192 gold badges9 silver badges10 bronze badges 3 In my case, Ubuntu, the shortcut is ctrl+shift+A.
nbro 14.3k27 gold badges104 silver badges188 bronze badges
answered Feb 20, 2017 at 10:57
Ashutosh JhaAshutosh Jha 14.2k9 gold badges49 silver badges80 bronze badges 3 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. answered Dec 16, 2015 at 16:24
jottrjottr 3,1673 gold badges26 silver badges34 bronze badges 3 In
Option + Shift + A
Or, Select all lines and then press CTRL + / answered Dec 6, 2017 at 6:53
Sajib KhanSajib Khan 21.1k8 gold badges60 silver badges71 bronze badges 2 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 Update: As VS Code has become pretty much standard editor for almost everything these days, I would say picking option 1 is always helpful. answered Nov 10, 2017 at 7:44
im_tsmim_tsm 1,82516 silver badges29 bronze badges 1 For my keyboard layout it's Ctrl + § for:
And Shift + Alt + A for:
J. Chomel 7,98615 gold badges41 silver badges65 bronze badges answered Apr 4, 2017 at 8:06
SumpfkrautSumpfkraut 3012 silver badges4 bronze badges 1 For me to comment I use: Ctrl + k, Ctrl + c and to uncomment: Ctrl + k, Ctrl + u I am using answered Mar 30, 2020 at 18:03
Yacine RouiziYacine Rouizi 9102 gold badges11 silver badges30 bronze badges To comment multiple line on visual code use shift+alt+a To comment single line use ctrl + /
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Apr 3, 2018 at 6:24
KarthigaKarthiga 8292 gold badges15 silver badges33 bronze badges 1
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Mar 30, 2017 at 19:22
RakeshRakesh 2,63428 silver badges28 bronze badges 1 Win10 with French / English Keyboard CTRL + / , ctrl+k+u and ctrl+k+l don't work. Here's how it works:
É key is next to right Shift.
answered May 8, 2018 at 2:49
ArsTVArsTV 3213 silver badges5 bronze badges All the key board shorcuts for VS code can be found in the link : Link
answered Sep 19, 2020 at 15:24
CTRL + SHIFT + A for CSS multiline
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Nov 3, 2017 at 14:45
charlyRootcharlyRoot 1511 silver badge9 bronze badges If you are using VSCode in a linux environment, then you can comment multiple lines by either: Selecting a block of code => then, press Ctrl + Shift + A (Block commenting) Or, selecting a block of code => then, press Ctrl + / (Single-line commenting applied to all selected lines) Hope this helps.
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Mar 15, 2019 at 12:41
Sabbir AhmedSabbir Ahmed 1,3981 gold badge14 silver badges20 bronze badges In the new version of VSCODE ( version 1.26.1)
You can assign any shortcuts you want. Hope it helps.
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Sep 4, 2018 at 21:51
Ragavan RajanRagavan Rajan 3,8931 gold badge24 silver badges42 bronze badges For multiline commenting in Python VSCode, all you have to do it just: Ctrl + / answered Aug 23, 2020 at 7:25
You can find the shortcut in the Edit menu :
answered Mar 29, 2019 at 15:03
Sylvain RodrigueSylvain Rodrigue 4,5755 gold badges50 silver badges62 bronze badges visual studio 2017 we do a: Comment Selection Ctrl+K, Ctrl+C press Ctrl+K to get shortcut. press Ctrl+C to confirm http://visualstudioshortcuts.com/2017/
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Dec 23, 2017 at 0:00
Joao VictorJoao Victor 4225 silver badges7 bronze badges 3 On Windows 10 you can use CTRL + } to comment/uncomment on any line or block of code. answered Nov 25, 2020 at 15:58
CamiloCamilo 5,6642 gold badges34 silver badges52 bronze badges For doing on mac: CMD + Shift + 7
Stephen Rauch♦ 45.7k30 gold badges105 silver badges126 bronze badges answered Sep 13, 2017 at 13:37
For me it was ctrl + ' (I am using a swedish layout for the keyboard). Hope that helps anyone.
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Aug 28, 2017 at 19:49
martin36martin36 2,0933 gold badges17 silver badges27 bronze badges 1 Select lines which you want to Comment Then press Ctrl + / to make selected lines comment And to uncomment: answered May 19, 2020 at 15:52
In windows you need to press ctrl + / in mac you can do ⌘ + / to make multiple comment
Then if you want to un-comment then select the lines again and then press ctrl + /(in windows) again ⌘ + /(in mac).
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Jun 23, 2018 at 8:31
Prashant BarvePrashant Barve 3,9952 gold badges32 silver badges42 bronze badges If your Ctrl+/ isn't working maybe you need to change it to Ctrl+NumPad_Divide.
answered Mar 7, 2021 at 14:17
andzandz 2621 gold badge3 silver badges12 bronze badges 1 1.Select the text, Press Cntl + K, C to comment (Ctr+E+C ) 2.Move the cursor to the first line after the delimiter // and before the Code text. 3.Press Alt + Shift and use arrow keys to make selection. ... 4.Once the selection is done, press space bar to enter a single space. answered Oct 31, 2017 at 20:08
Multi-Line Comment in VS Code To comment the code select the lines and hit: Alt + Shift + A To Uncomment select the commented code and hit: Alt + Shift + A
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Feb 28, 2020 at 11:27
For windows, the default key for multi-line comment is Alt + Shift + A For windows, the default key for single line comment is Ctrl + /
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Feb 25, 2020 at 6:02
Anoop P SAnoop P S 6941 gold badge11 silver badges30 bronze badges 0 CTRL + SHIFT + A For Red Hat,centos
ROOT 11k5 gold badges30 silver badges43 bronze badges answered Dec 12, 2017 at 5:48
RAHUL KUMARRAHUL KUMAR 1,00511 silver badges9 bronze badges How do you comment multiple lines at once Vscode?Comment out multiple lines of selected code. If the file is already opened in Visual Studio Code. ... . 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.. How do you comment out multiple lines of code in Python?To comment out multiple lines in Python, you can prepend each line with a hash ( # ). With this approach, you're technically making multiple single-line comments.
How do you comment out multiple lines in Visual Studio Python?All you need to do is select the block of code and type ctrl+1. You should be all set!
What is the shortcut to comment multiple lines in Python?From the main menu, select Code | Comment with Line Comment. Press Ctrl+/ .
|