PyCharm Delete Whole Line with cursor moving up

Viewed 4007

A very specific question, for use on Mac OS:

In VSCode, it's very easy to simply hold ⌘ Command and hit ⌫ Delete for however many whole lines I want to delete and the cursor will keep deleting upward.

However, running PyCharm, it's not available, and I'm having trouble mapping the exact feature.

Going to Preferences -> Keymap -> Editor Actions allows you to map "Delete Line," but using this will just delete downward. Is there a way to mimic the feature of being able to hold down ⌘ Command and just ⌫ Delete lines upward?

3 Answers

To find the shortcut on your setup open up the "Search Everywhere" box with one of the following:

  • Double ⇧ Shift
  • ⌘ Command+P
  • ⌘ Command+⇧ Shift+P (opens directly on Actions tab)

Then go to the "Actions" tab and search for the shortcut you are looking for, in this case "Delete Line":

enter image description here

Then it shows the shortcut (in my case ⌃ Control+⇧ Shift+K)

In the Jetbrains documentation it does not show up anything to remove a whole line (or at least, I am missing it out).

I know it is not the same, as what you do in VScode is much faster, but you can always shift+home(gets you the whole line if you are at the end of the line)+delete.

I do not think there is another way from jetbrain's doc.

EDIT:

I think I found it by cassualty: R shift+ del.

EDIT2: Just found out that R shift+ del actually cuts (like ctrl+ x).

I know that the post is a bit old but I think it worths to post the 'actual' solution to this issue.

Basically, when you try to delete line in PyCharm for Mac, the IDE is deleting the caret (according to the documentation). Although, IdeaVim plug-in is making your life even more difficult if you don't know how to use it. I don't have experience either.

Disabling IdeaVim plug-in will solve the problem. The IDE will ask you to restart it in order to apply the new settings. After that you can select whatever you want in your code and just hit the backspace button on your Mac to delete. And, yes, all these issues with the key shortcuts are caused by the IdeaVim.

The IdeaVim extension can be disabled from the PyCharm Preferences.

Related