Reputation: 793
In Corey Schafer's Programming Terms: Mutable vs Immutable, at 3:06, he selected multiple lines and commented them out in PyCharm all in one action.
What is this action? Is it a built-in shortcut in PyCharm that I can use or configure myself?
Upvotes: 32
Views: 153407
Reputation: 1
if you are familliar with vscode shortcuts for this case ctrl+k ctrl+c for comment and ctrl+k ctrl+u for uncomment , you can go to settings icon in the top bar , then to keymap then to "Install Keymap" , then you find Visual Studio Keymap , and thats it I wish it help
Upvotes: 0
Reputation: 1
Highlight the region and type Ctrl+'. This is better than the Ctrl+/ which puts a #
infront of every line.
Upvotes: -4
Reputation: 29
this is not the shortcut but an alternative: using 3 single (''') or double quotation marks (""") in the beginning and also at the end of a bunch of lines.
Upvotes: 2
Reputation: 49
For a QWERTY keyboard layout you can use Ctrl + NumPad / to comment something out
Upvotes: 4
Reputation: 159
Years later: on AZERTY keyboard, '/' from syntax area (;.:/!§,?), AKA "slash" does not work! You have to use the '/' symbol from numbers area (division symbol).
Upvotes: 15
Reputation: 1342
If you use macbook build-in keyboard, this shortcut does not work. So you can assign new shortcut for this purpose by following steps;
1.Go keymap menu
PyCharm -> Preferences -> Keymap
2.Find "comment with line comment" then click pencil sign "add keyboard shortcut" then assign your custom shortcut (press your favorite keyboard combination)
Upvotes: 2
Reputation: 2905
This is a setting you can change and define in "Settings".
The default is with Ctrl+/ for Windows, or Cmd+/ for Mac.
Upvotes: 65
Reputation: 229
Is depends on you're text editor , but probably all text editor use (ctrl + /) just highlight all the code you need to comments and use the shortcut , to know what shortcut using in you're favorite text editor search in google : YourTextEditor shortcuts
Upvotes: 2
Reputation: 1
This heavily depends on where you're writing your python code. If you're writing it in Notepad, there won't be a shortcut for commenting a line.
However, if you use an IDE, you will probably have such capability alongside the ability to change the shortcut. Just search Google for keyboard shortcuts for your preferred IDE.
Upvotes: -5