Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

IPython shortcuts

Shortcuts available in an IPython terminal.

Note

This list is automatically generated. Key bindings defined in prompt_toolkit may differ between installations depending on the prompt_toolkit version.

  • Comma-separated keys, e.g. Esc, f, indicate a sequence which can be activated by pressing the listed keys in succession.

  • Plus-separated keys, e.g. Esc + f indicate a combination which requires pressing all keys simultaneously.

  • Hover over the ⓘ icon in the filter column to see when the shortcut is active.

You can use TerminalInteractiveShell.shortcuts configuration to modify, disable or add shortcuts.

Shortcut

Description and identifier

Filter

{

Auto-close braces.
IPython:auto_match.braces

[

Auto-close brackets.
IPython:auto_match.brackets

ctrl + h (or backspace)

Delete auto-closed parenthesis.
IPython:auto_match.delete_pair

ctrl + h (or backspace)

Delete auto-closed parenthesis.
IPython:auto_match.delete_pair

ctrl + h (or backspace)

Delete auto-closed parenthesis.
IPython:auto_match.delete_pair

ctrl + h (or backspace)

Delete auto-closed parenthesis.
IPython:auto_match.delete_pair

ctrl + h (or backspace)

Delete auto-closed parenthesis.
IPython:auto_match.delete_pair

"

Auto-close docstring (double quotes).
IPython:auto_match.docstring_double_quotes

'

Auto-close docstring (single quotes).
IPython:auto_match.docstring_single_quotes

"

Auto-close double quotes.
IPython:auto_match.double_quote

(

Auto-close parenthesis.
IPython:auto_match.parenthesis

{

Auto-close braces in raw strings.
IPython:auto_match.raw_string_braces

[

Auto-close bracker in raw strings.
IPython:auto_match.raw_string_bracket

(

Auto-close parenthesis in raw strings.
IPython:auto_match.raw_string_parenthesis

'

Auto-close single quotes.
IPython:auto_match.single_quote

}

Skip over automatically added parenthesis/quote.
IPython:auto_match.skip_over

]

Skip over automatically added parenthesis/quote.
IPython:auto_match.skip_over

)

Skip over automatically added parenthesis/quote.
IPython:auto_match.skip_over

"

Skip over automatically added parenthesis/quote.
IPython:auto_match.skip_over

'

Skip over automatically added parenthesis/quote.
IPython:auto_match.skip_over

ctrl + f

Accept autosuggestion.
IPython:auto_suggest.accept

right

Accept autosuggestion.
IPython:auto_suggest.accept

escape, down

Accept autosuggestion and keep cursor in place.
IPython:auto_suggest.accept_and_keep_cursor

ctrl + left

Accept autosuggestion and move cursor left in place.
IPython:auto_suggest.accept_and_move_cursor_left

escape, right

Fill partial autosuggestion by character.
IPython:auto_suggest.accept_character

end

Apply autosuggestion or jump to end of line.
IPython:auto_suggest.accept_or_jump_to_end

ctrl + e

Apply autosuggestion or jump to end of line.
IPython:auto_suggest.accept_or_jump_to_end

ctrl + right

Fill partial autosuggestion by token.
IPython:auto_suggest.accept_token

escape, f

Fill partial autosuggestion by word.
IPython:auto_suggest.accept_word

ctrl + h (or backspace)

Resume autosuggestions after deleting last character.
IPython:auto_suggest.backspace_and_resume_hint

escape

Discard autosuggestion.
IPython:auto_suggest.discard

delete

Discard autosuggestion.
IPython:auto_suggest.discard

ctrl + down

Go down and update hint.
IPython:auto_suggest.down_and_update_hint

right

Resume autosuggestions.
IPython:auto_suggest.resume_hinting

ctrl + down

Get previous autosuggestion from history.
IPython:auto_suggest.swap_autosuggestion_down

ctrl + up

Get next autosuggestion from history.
IPython:auto_suggest.swap_autosuggestion_up

ctrl + up

Go up and update hint.
IPython:auto_suggest.up_and_update_hint

ctrl + g

Dismiss completion.
IPython:shortcuts.dismiss_completion

ctrl + m (or enter)

.
IPython:shortcuts.handle_return_or_newline_or_execute

ctrl + i (or tab)

Indent buffer.
IPython:shortcuts.indent_buffer

ctrl + o

Insert a newline after the cursor indented appropriately.
IPython:shortcuts.newline_autoindent

ctrl + n

Control-N in vi edit mode on readline is history previous, unlike default prompt toolkit.
IPython:shortcuts.next_history_or_next_completion

f2

Open code from input in external editor.
IPython:shortcuts.open_input_in_editor

ctrl + p

Control-P in vi edit mode on readline is history next, unlike default prompt toolkit.
IPython:shortcuts.previous_history_or_previous_completion

ctrl + \

Quit application with SIGQUIT if supported or sys.exit otherwise.
IPython:shortcuts.quit

-

escape, ctrl + m (or enter)

Reformat code and execute it.
IPython:shortcuts.reformat_and_execute

ctrl + c

Reset buffer.
IPython:shortcuts.reset_buffer

ctrl + c

Reset search buffer.
IPython:shortcuts.reset_search_buffer

ctrl + z

Suspend to background.
IPython:shortcuts.suspend_to_bg

ctrl + v

Stub used on other platforms.
IPython:shortcuts.win_paste

right

Accept suggestion.
prompt_toolkit:auto_suggest._accept

ctrl + e

Accept suggestion.
prompt_toolkit:auto_suggest._accept

ctrl + f

Accept suggestion.
prompt_toolkit:auto_suggest._accept

escape, f

Fill partial suggestion.
prompt_toolkit:auto_suggest._fill

ctrl + i (or tab)

Key binding handler for readline-style tab completion.
prompt_toolkit:completion.display_completions_like_readline

ctrl + b

Move back a character.
prompt_toolkit:named_commands.backward_char

ctrl + w

Kills the word before point, using “not a letter nor a digit” as a word boundary.
prompt_toolkit:named_commands.backward_kill_word

escape, h

Kills the word before point, using “not a letter nor a digit” as a word boundary.
prompt_toolkit:named_commands.backward_kill_word

escape, b

Move back to the start of the current or previous word.
prompt_toolkit:named_commands.backward_word

ctrl + a

Move to the start of the current line.
prompt_toolkit:named_commands.beginning_of_line

escape, c

Capitalize the current (or following) word.
prompt_toolkit:named_commands.capitalize_word

escape, l

Lowercase the current (or following) word.
prompt_toolkit:named_commands.downcase_word

ctrl + x, ctrl + e

Invoke an editor on the current command line, and accept the result.
prompt_toolkit:named_commands.edit_and_execute

v

Invoke an editor on the current command line, and accept the result.
prompt_toolkit:named_commands.edit_and_execute

ctrl + x, ctrl + e

Invoke an editor on the current command line, and accept the result.
prompt_toolkit:named_commands.edit_and_execute

ctrl + x, e

Invoke an editor on the current command line, and accept the result.
prompt_toolkit:named_commands.edit_and_execute

ctrl + k

Kill the text from the cursor to the end of the line.
prompt_toolkit:named_commands.kill_line

escape, d

Kill from point to the end of the current word, or if between words, to the end of the next word.
prompt_toolkit:named_commands.kill_word

ctrl + _

Incremental undo.
prompt_toolkit:named_commands.undo

escape, u

Uppercase the current (or following) word.
prompt_toolkit:named_commands.uppercase_word

ctrl + y

Paste before cursor.
prompt_toolkit:named_commands.yank

escape, .

Like yank_nth_arg, but if no argument has been given, yank the last word of each line.
prompt_toolkit:named_commands.yank_last_arg

escape, y

Rotate the kill ring, and yank the new top.
prompt_toolkit:named_commands.yank_pop

ctrl + m (or enter)

Accept input when enter has been pressed.
prompt_toolkit:prompt._accept_input

ctrl + i (or tab)

Display completions (like Readline).
prompt_toolkit:prompt._complete_like_readline

ctrl + d

Exit when Control-D has been pressed.
prompt_toolkit:prompt._eof

<sigint>

Abort when Control-C has been pressed.
prompt_toolkit:prompt._keyboard_interrupt

-

ctrl + c

Abort when Control-C has been pressed.
prompt_toolkit:prompt._keyboard_interrupt

ctrl + z

Suspend process to background.
prompt_toolkit:prompt._suspend