PyCharm 2024.3 Help

Smart Keys

Use this page to enable or disable specific smart keys and to define which actions you want to be invoked automatically.

Item

Description

Home moves caret to first non-whitespace character

When this checkbox is selected, on pressing Home, the caret is positioned at the first non-whitespace character of the current line. Pressing Home subsequently moves the caret from the Smart Home position to the first column and back.

End on blank line moves caret to indent position

When this checkbox is selected, on pressing End in an empty line, the caret is positioned with the indent, which PyCharm assumes to be reasonable in the current code point (indentation is based on the current Code Style Settings).

Insert pair brackets (), [], {}, <>

Select this checkbox to have PyCharm automatically add a closing bracket for each typed opening bracket, respectively.

Insert pair quote

Select this checkbox to have PyCharm automatically add a closing single or double quote for each typed opening single or double quote, respectively. See page Create documentation comments

Reformat block on typing '}'

If this checkbox is selected, then, on typing the closing curly brace, the enclosed code block is reformatted automatically if the formatting of this code block does not match the selected code style.

Use "CamelHumps" words

Select this checkbox to have PyCharm discern separate words within CamelHump names. Words within a name should start with a capital letter or an underscore. This option impacts some editor actions, for example:

  • Caret Move Ctrl+Right/Ctrl+Left

  • Caret Move with Selection (Ctrl+Shift+Right/Ctrl+Shift+Left)

  • Select Word at Caret Ctrl+W

  • Delete to Word Start/End (Ctrl+Backspace and Ctrl+Delete respectively)

  • Double-clicking (if Honor "CamelHumps" word settings when selecting using double click is enabled).

Honor "CamelHumps" words settings when selecting on double click

Select this checkbox to have PyCharm invoke the CamelHumps selection when words are selected by double-clicking.

This feature works only if the Use 'CamelHumps' words option is enabled.

Surround selection on typing quote or brace

If this checkbox is selected, the selected text on typing a quote, double-quote or brace, will be surrounded with these characters. If this checkbox is not selected, then the typed quotes, double-quotes or braces will replace the selection.

Add multiple carets on double Ctrl with arrow keys

If this checkbox is selected, then:

  • pressing Ctrl plus up/down arrow keys leads to creating multiple carets.

  • pressing Ctrl plus left/right arrow keys or Home/End leads to creating a selection.

For more information, refer to the Multicursor section.

Jump outside closing bracket/quote with Tab when typing

If this checkbox is selected, pressing Tab when typing inside brackets/quotes will move the caret outside the closing bracket/quote. If this checkbox is not selected, pressing Tab will insert the Tab character.

Note that this only works on initial typing: during subsequent editing, pressing Tab inside brackets/quotes will insert the Tab character.

Enter

Use this area to define the actions to be invoked by pressing Enter.

  • Smart indent: select this checkbox to have PyCharm add a new line and place the caret at it, with the indent that PyCharm assumes to be reasonable in the current point of code (indentation is based on the current Code Style settings).

    If the checkbox is cleared, upon pressing Enter in a blank line, PyCharm adds a new line and positions the caret at the current non-space character column.

  • Insert pair '}': select this checkbox to have PyCharm automatically position a closing brace } at the proper column when Enter is pressed in an empty line. In this case PyCharm seeks backward for the nearest unclosed opening brace { and places the closing one at the corresponding indentation level.

  • Close block comment: unselect this checkbox to disable the automatic closure of the block comment when hitting Enter.

  • Insert documentation comment stub: this checkbox defines the behavior on pressing Enter after the opening documentation comment. This functionality works only for JavaScript , Java, Groovy, and Swift.

    • If this checkbox is selected, PyCharm generates a documentation comment stub.

      For the function comments, this stub contains the required tags (@param tags for each parameter declared in the signature, and @return). For more information, refer to Create documentation comments, JSDoc comments.

    • If this checkbox is not selected, only the closing part of the comment is generated.

Unindent on Backspace

Use this list to define the actions to be invoked by pressing Backspace key. The available options are:

  • Disabled: pressing Backspace returns the caret by one position at a time.

  • To nearest indent position

  • To proper indent position

Reformat on paste

Use this list to specify how to place pasted code blocks. The available options are:

  • None: the pasted code is inserted at the caret location as plain text without any reformatting or indenting.

  • Indent block: the pasted code block is positioned at the proper indentation level, according to the current Code Style Settings, but its inner structure is not changed.

  • Indent each line: each line of the pasted code block is positioned at the proper indentation level, according to the current Code Style Settings.

  • Reformat block: the pasted code block is reformatted according to the current Code Style Settings.

Reformat again to remove custom line breaks

When this option is enabled, invoking the Reformat Code Ctrl+Alt+L or Reformat File Ctrl+Alt+Shift+L actions the second time after the code has been reformatted will remove custom line breaks.

When the option is disabled, invoking the actions the second time opens a dialog in which you need to confirm removing line breaks first. Click Don't ask again in the dialog to never remove custom line breaks when you reformat code for the second time.

Smart indent pasted lines

If this checkbox is selected, the pasted lines are indented relative to the current caret location. Otherwise, the pasted lines are indented relative to the first column.

Insert backslash when pressing Enter inside the statement

  • If this checkbox is selected, the continuation character will be inserted automatically on pressing Enter, preserving the correct syntax.

  • If this checkbox is not selected, the line will be broken, and syntax error will be reported by on-the-fly code inspection.

Insert 'self' when defining a method

If this checkbox is selected, the self parameter is inserted automatically after typing the opening brace, together with the closing brace and colon.

If this checkbox is cleared, only closing brace is generated automatically.

When necessary, use the suggested quick-fix to insert self:

py_self.png

Insert type placeholders in the documentation comment stub

If this checkbox is selected, then the placeholders for parameters, types and return types will be generated:

""" :param a: :type a: :return: :rtype: """

If this checkbox is not selected, then only the placeholders for parameters and return will be generated:

""" :param a: :return: """

Insert 'type' and 'rtype' to the documentation comment stub

If this checkbox is selected, the documentation comment stub will contain type tag for each parameter, and rtype tag for the return statement.

Auto-insert closing }} and %} in Django templates

If this checkbox is selected, the closing characters will be automatically inserted after typing the opening ones.

AngularJS

Use this area to define the behavior of AngularJS:

  • Auto-insert white space in the interpolation:

    • If this checkbox is selected, a white space is automatically inserted between the braces: {{ }}.

    • If this checkbox is not selected, the white space is not inserted: {{}}.

Last modified: 15 November 2024