Withnail
Withnail

Reputation: 720

How to skip over closing braces / brackets / parentheses in PyCharm?

I can't get the auto-indentations to work properly unless I use the automatic closing of braces, et al (which I don't like), and I see no option allowing one to skip over/out.

Eclipse has a configuration option for this, and Visual Studio doesn't auto-close everything by default, but rather formats the code block after manually entering the closing brace (which I rather prefer).

Surely there's something apart from going all the way over to the "End" key?

Edit / update:

As I consider it bad form to leave a question without a marked answer, would someone with more recent experience with PyCharm (I haven't used it in quite some time) weigh in with a recommendation for the best among the below solutions? Perhaps there's a newer configuration option or simple solution not yet listed?

Upvotes: 16

Views: 8520

Answers (3)

Marlen T. B.
Marlen T. B.

Reputation: 884

Shift + Enter will jump past completions and drop you onto the next line.

Ctrl + ] will jump to the end of the current element.

This seems to work in most cases to skip past auto-completions. I find it the most versatile of the options.

Ctrl + [ will jump you to the start of whatever code block you are in.

As previously mentioned Ctrl + Shift + Enter will add any extra auto-completions you might need and drop onto a new line.

Upvotes: 7

guettli
guettli

Reputation: 27107

A college told me a solution:

First you type this:

def test_foo(

PyCharm inserts self) as soon as you type (

Current state: ^ indicates the cursor position:

def test_foo(self^):

Just type ): and hit ENTER, and you are on the next line.

Since I type with ten fingers Ctrl-Shift-Enter is not a solution for me in such common editing operations.

Upvotes: 3

yole
yole

Reputation: 97328

Press Ctrl-Shift-Enter to close the missing braces on the current line (if any), add the missing colon (if missing) and put the caret into the correctly indented position on the next line.

Upvotes: 9

Related Questions