Reputation: 1525
Does anybody using a German keyboard have found a solution to this? Ctrl+/ is not possible since it is necessary to push shift+7 to get the slash. But when I do Ctrl+shift+7 I get a bookmark called 7 on that line. Commenting code is very time wasting like that, especially when commenting xml lines.
Upvotes: 43
Views: 30533
Reputation: 1
If you don't want to redo the keymaps yourself, there's a plug-in which has predefined remaps for some languages (- instead of / for german, ...): https://plugins.jetbrains.com/plugin/14625-keymap-nationalizer
You can also customize the remaps
Upvotes: 0
Reputation: 11
Settings -> Keymap -> Main Menu -> Code -> Comment Actions
(or put 'comment' in search box)
You will see 'Comment with line Comment', remove what is there (right click, remove), add what you want after.
As a beginner, I need only 1 or 2 shortcuts, and one of them is comments, so just delete whatever is your shortcut already assigned to when the window pops up.
Upvotes: 1
Reputation: 51
I solved it by mapping the US keyboard layout (QWERTY) to the fn-key (I don't have numberpad):
By pressing first [fn] and then [CMD] + [-] it will comment out the marked code lines in pycharm. I hope this might help others who don't have a numberpad.
Upvotes: 0
Reputation: 10386
Keyboard shortcuts are completely customizable in PyCharm
Following is an instruction given in PyCharm2017.1 Help:
Open the Settings dialog box, and click Keymap.
Select one of the pre-configured Keymaps, which you want to use as the base for the new one, and click Copy. Accept the default name, or change it as required.
In the content pane of actions, select the desired action.
Configure keyboard shortcuts. To do that, follow these steps:
Click /help/img/idea/2017.1/properties.gif on the toolbar, or right-click the selected action, and choose Add Keyboard Shortcut. Enter Keyboard Shortcut dialog box opens.
Press the keys to be used as shortcuts. The keystrokes are immediately reflected in the First Stroke field. Optionally, select the check box next to Second Stroke and press keys to be used as alternative keyboard shortcuts. As you press the keys, the Preview field displays the suggested combination of keystrokes, and the Conflicts field displays warnings, if some of the keystrokes are already assigned to the other actions.
Note: Click OK with the mouse pointer to create a shortcut and bind it with an action.
Upvotes: 5
Reputation: 1422
I assigned CMD + # to line comments on my German notebook keyboard without numpad. I think this is a good mnemonic for python comments although editors use something with /
in their comment shortcuts (C is a bit older than Python :).
Mac: CMD + , -> Keymap -> search for 'comment' -> right click -> Add Keyboard Shortcut -> press
CMD + #. (As already outline by LazyOne)
Unfortunately I did not get CMD + SHIFT + # to work for block comments. There seems to be a SHIFT problem with pycharms keyboard map.
Upvotes: 3
Reputation: 1041
If you have a numberpad on your keyboard you can use Ctrl and the division sign on your numpad.
Found this in the Bugreports pointed out by LazyOne
Upvotes: 51
Reputation: 165228
Choose another working-for-you shortcut for that action at Settings (Preferences on Mac) | Keymap
(just use search field to find the right action).
Other than that: watch these tickets (star/vote/comment) to get notified on progress.
Upvotes: 20