Spyder IDE keyboard shortcuts for Windows and Linux

Spyder's default keyboard shortcuts for Windows and Linux, taken from the defaults file of release 6.1.7. The Mac forms are documented only case by case — the docs give Cmd-T for Ctrl-T — so the page has a single column. Code runs in pieces: F5 runs the file, F9 the selection and Ctrl + Enter the current cell. Commands without a default key are left out, and every binding can be changed in Preferences › Keyboard shortcuts.

155 shortcuts in 10 sections. Checked row by row against Spyder 6.1.7 source code (GitHub tag v6.1.7) on . Edited by Jay.

Code execution 16

ActionWindows / Linux
Run fileRuns the whole file open in the Editor; output and errors appear in the IPython Console.F5
Configuration per fileOpens the run settings for the current file, such as its working directory, console mode and command-line arguments.Ctrl+F6
Re-run last fileRuns again the file most recently started with the Run command.F6
Run cellRuns the cell that holds the cursor; cells are blocks separated by # %% comment lines.Ctrl+Enter
Run cell and advanceRuns the current cell, then jumps to the next one, so a script can be stepped through cell by cell.Shift+Enter
Re-run last cellRuns again whichever cell was executed most recently.Alt+Enter
Run selection or current lineExecutes the selected lines, or the current line when nothing is selected, in which case the cursor then moves down a line.F9
Run to lineRuns every line from the top of the file down to, but not including, the current line.Shift+F9
Run from lineRuns the current line and everything after it to the end of the file.Alt+F9
Create new cellInserts a # %% separator at the current line, which starts a new cell there.Ctrl+2
Go to next cellMoves the cursor to the cell below without running any code.Ctrl+Down
Go to previous cellMoves the cursor back to the cell above the current one.Ctrl+Up
Run code analysisChecks the file focused in the Editor with Pylint and lists the findings in the Code Analysis pane.F8
Profile fileRuns the file open in the Editor under the Profiler, which reports run time and call counts per function.F10
Profile cellProfiles only the cell that contains the cursor instead of the whole file.Alt+F10
Search profiler resultsShows or hides the search box of the Profiler pane.Ctrl+F

Debugging 11

ActionWindows / Linux
Debug fileStarts the file open in the Editor under Spyder's IPdb-based debugger.Ctrl+F5
Debug cellSends only the cell at the cursor to the debugger.Alt+Shift+Enter
Debug selection or current lineDebugs the selected lines, or the line at the cursor when nothing is selected.Ctrl+F9
Debug current lineExecutes the line the debugger is stopped on and pauses again at the next one.Ctrl+F10
Step into function or methodFollows a call on the current line into the function or method it invokes.Ctrl+F11
Execute until function returnsRuns the rest of the current function or method and stops when it returns.Ctrl+Shift+F11
ContinueResumes execution until the next breakpoint is reached.Ctrl+F12
Stop debuggingEnds the debugging session; like the other debugger control keys it is a global shortcut.Ctrl+Shift+F12
Toggle breakpointAdds a breakpoint to the cursor's line, or removes the one already there.F12
Set or edit conditional breakpointAsks for the condition of a new breakpoint, or lets the condition of an existing one be changed.Shift+F12
Search framesShows or hides the search box of the Debugger pane, which lists the execution stack.Ctrl+F

Code editing 30

The defaults file also sets mouse modifiers for the Editor: a click with Ctrl+Alt adds or removes a cursor, and a click with Ctrl+Alt+Shift adds a column of cursors.

ActionWindows / Linux
UndoReverses the most recent edit in the Editor.Ctrl+Z
RedoReapplies the edit that was just undone.Ctrl+Shift+Z
CutRemoves the selection to the clipboard; with nothing selected in the Editor, Ctrl+X takes the whole current line.Ctrl+X
CopyCopies the selection to the clipboard; with nothing selected in the Editor, Ctrl+C takes the whole current line.Ctrl+C
PasteInserts the clipboard contents at the cursor position.Ctrl+V
Select allSelects the whole text of the file being edited.Ctrl+A
DeleteErases the selected text or, without a selection, the character after the cursor.Delete
Code completionOpens the completion list on demand; suggestions also appear automatically while typing.Ctrl+Space
Inspect current objectShows help for the object at the cursor in the Help pane; both consoles use the same default.Ctrl+I
Toggle commentComments or uncomments the current line, or every line of the selection.Ctrl+1
Add block commentTurns the current line or the selected lines into a comment block.Ctrl+4
Remove block commentStrips the comment block around the cursor or the selection in the Editor.Ctrl+5
IndentIndents the current line or selection one level, wherever the cursor is on the line.Ctrl+]
UnindentTakes one indentation level off the current line or the selected lines.Ctrl+[
Indent selectionIndents the selected text; the key is fixed in the editor's key handler, not set in Preferences.Tab
Unindent selectionRemoves an indent level from the selected text; handled inside the editor like the Tab key.Shift+Tab
Delete lineRemoves the whole line under the cursor without selecting it first.Ctrl+D
Duplicate line downCopies the current line or selection and places the duplicate after it.Ctrl+Alt+Page Down
Duplicate line upCopies the current line or selection and places the duplicate before it.Ctrl+Alt+Page Up
Move line upShifts the current line, or all selected lines, one line higher.Alt+Up
Move line downShifts the current line, or all selected lines, one line lower.Alt+Down
Change to uppercaseConverts the selection, or the current line when nothing is selected, to capital letters.Alt+Shift+U
Change to lowercaseConverts the selection, or the current line when nothing is selected, to small letters.Alt+U
Go to new lineOpens a fresh line below from any cursor position, leaving the current line's text intact.Ctrl+Shift+Enter
Generate docstringWrites a docstring for the function at the cursor; Numpydoc is the default style.Ctrl+Alt+Shift+D
Format file or selectionFormats the selected fragment, or the whole Editor file when nothing is selected, with the configured formatter.Ctrl+Alt+I
Enter array inlineOpens the array builder in inline mode; the IPython Console has the same default.Ctrl+Alt+M
Enter array tableOpens the array builder in table mode, in the Editor and in the IPython Console.Ctrl+M
Add cursor upPlaces an additional cursor on the line above, for typing in several places at once.Alt+Shift+Up
Add cursor downPlaces an additional cursor on the line below the current one.Alt+Shift+Down

Cursor movement and kill ring 16

Meta is the modifier name used in Spyder's defaults file. The file also sets its CTRL constant to Meta on macOS, so there Run cell, Debug selection, Code completion, Duplicate line and Go to next or previous file are built on Meta as well.

ActionWindows / Linux
Go to start of lineMoves the cursor to the first position of its line.Meta+A
Go to end of lineMoves the cursor past the last character of its line.Meta+E
Go to previous lineMoves the cursor up one line, as the Up arrow does.Meta+P
Go to next lineMoves the cursor down one line, as the Down arrow does.Meta+N
Go to previous characterMoves the cursor one character to the left.Meta+B
Go to next characterMoves the cursor one character to the right.Meta+F
Go to previous wordJumps back over one word instead of a single character.Ctrl+Left
Go to next wordJumps forward over one word instead of a single character.Ctrl+Right
Go to start of documentMoves to the very beginning of the file and clears any extra cursors.Ctrl+Home
Go to end of documentMoves to the very end of the file and clears any extra cursors.Ctrl+End
Kill to line endRemoves the text from the cursor to the end of the line and stores it in the kill ring.Meta+K
Kill to line startRemoves the text between the start of the line and the cursor, keeping it in the kill ring.Meta+U
Kill previous wordRemoves the word before the cursor and adds it to the kill ring.Meta+Backspace
Kill next wordRemoves the word after the cursor and adds it to the kill ring.Meta+D
YankInserts the most recently killed text at the cursor.Meta+Y
Rotate kill ringRight after a yank, replaces the inserted text with the previous entry of the kill ring.Meta+Shift+Y

Search and navigation 17

For macOS the defaults file assigns other keys to three of these commands: Find next and Find previous are written Ctrl+G and Ctrl+Shift+G there, and Go to definition is F3.

ActionWindows / Linux
Find textOpens the find panel below the Editor; matches are highlighted and counted as the search string is typed.Ctrl+F
Find nextJumps to the following match; for macOS the same line of the file assigns a different key, written Ctrl+G.F3
Find previousJumps back to the preceding match; the macOS default in the file is written Ctrl+Shift+G.Shift+F3
Replace textOpens the find panel with its replace row visible.Ctrl+R
Replace allSubstitutes every match of the search text in one step.Alt+A
Hide find and replaceCloses the find panel while that panel has keyboard focus.Esc
Search text in filesOpens the Find pane for a text search across multiple files.Alt+Shift+F
Go to lineOpens a dialog that asks for the line number to jump to in the active file.Ctrl+L
Go to definitionJumps to where the name under the cursor is defined; the file gives this action F3 on macOS.Ctrl+G
Go to definition with a clickHold Ctrl and click a name in the Editor to open the place where it is declared.Ctrl+Click
Previous cursor positionReturns to the place the cursor occupied before the last jump.Alt+Left
Next cursor positionGoes forward again after stepping back through earlier cursor positions.Alt+Right
Last edit locationReturns to the spot where text was most recently changed.Ctrl+Alt+Shift+Left
Previous warning or errorMoves to the code analysis marker before the cursor.Ctrl+Alt+Shift+,
Next warning or errorMoves to the code analysis marker after the cursor.Ctrl+Alt+Shift+.
File switcherLists the open files; type part of a name and press Enter to switch to it.Ctrl+P
Symbol finderLooks up a symbol defined in the current file and jumps to it.Ctrl+Alt+P

Files and tabs 16

ActionWindows / Linux
New fileCreates a file in a new Editor tab.Ctrl+N
Open fileShows the file dialog and loads the chosen file into the Editor.Ctrl+O
Open last closedBrings back the file whose tab was closed most recently.Ctrl+Shift+T
Save fileWrites the current file to disk.Ctrl+S
Save allSaves every file open in the Editor in one step.Ctrl+Alt+S
Save asSaves the current file under a new name or in another folder.Ctrl+Shift+S
Close fileCloses the current file; the defaults file binds both keys to this command.Ctrl+WorCtrl+F4
Close allCloses every file that is open in the Editor.Ctrl+Shift+W
Go to next fileSwitches tabs in most-recently-used order rather than tab-bar order.Ctrl+Tab
Go to previous fileSteps backwards through the most-recently-used list of open files.Ctrl+Shift+Tab
Cycle to next fileMoves to the neighbouring tab in tab-bar order, not by recent use.Ctrl+Page Down
Cycle to previous fileMoves to the tab before the current one in tab-bar order.Ctrl+Page Up
Copy fileCopies the file or folder selected in the Files pane; the Projects pane has the same default.Ctrl+C
Paste filePastes the copied item into the Files pane; also the default in the Projects pane.Ctrl+V
Copy absolute pathPuts the full path of the item selected in the Files or Projects pane on the clipboard.Alt+Shift+C
Copy relative pathCopies the selected item's relative path from the Files or Projects pane.Alt+Shift+D

Panes and views 13

ActionWindows / Linux
Switch to EditorReturns focus to the Editor from any other pane, including panes undocked into their own windows.Ctrl+Shift+E
Switch to IPython ConsoleMoves focus to the IPython Console, where commands are typed and run.Ctrl+Shift+I
Switch to Variable ExplorerShows the Variable Explorer, which lists the objects of the selected console session.Ctrl+Shift+V
Switch to HelpShows the Help pane, where documentation for inspected objects is displayed.Ctrl+Shift+H
Switch to PlotsShows the Plots pane; the same line of the file gives macOS another letter, written Ctrl+Shift+J.Ctrl+Shift+G
Switch to FilesShows the Files pane, Spyder's built-in browser for files and folders.Ctrl+Shift+X
Switch to HistoryShows the History pane, the timestamped log of commands entered in the consoles.Ctrl+Shift+L
Switch to OutlineShows the Outline pane, a tree of the functions, classes and cells in open files.Ctrl+Shift+O
Switch to ProjectsShows the Projects pane with the files of the open project.Ctrl+Shift+P
Switch to FindShows the Find pane used for text searches across files.Ctrl+Shift+F
Switch to Code AnalysisShows the Code Analysis pane, where the Pylint results are listed.Ctrl+Shift+C
Switch to ProfilerShows the Profiler pane with the results of the last profiling run.Ctrl+Shift+R
Switch to DebuggerShows the Debugger pane with the execution stack and the breakpoint list.Ctrl+Shift+D

Window and layout 15

ActionWindows / Linux
Close current paneCloses the pane that currently has focus; the key works wherever the focus is.Ctrl+Shift+F4
Lock or unlock panesToggles whether panes and toolbars are locked in place.Ctrl+Shift+F5
Maximize current paneExpands the focused pane to fill the window; a second press restores the previous layout.Ctrl+Alt+Shift+M
Fullscreen modeSwitches the main window between full-screen and windowed display.F11
Use next layoutSwitches to the layout after the current one in the list of default and custom layouts.Alt+Shift+Page Down
Use previous layoutGoes back to the layout before the current one in the same list.Alt+Shift+Page Up
Split verticallyDivides the Editor into two panels; Spyder's Editor documentation writes this key as Ctrl-Shift-{.Ctrl+{
Split horizontallyDivides the Editor in the other direction; the Editor documentation writes this key as Ctrl-Shift-- (Shift with minus).Ctrl+_
Close split panelRemoves the selected split panel, leaving the remaining Editor panels.Alt+Shift+W
Zoom inEnlarges the Editor's text; the defaults file binds two keys to this command.Ctrl++orCtrl+=
Zoom outShrinks the Editor's text by one step.Ctrl+-
Zoom resetReturns the Editor's text to its normal size.Ctrl+0
Spyder documentationOpens Spyder's online documentation; the key works from any pane.F1
RestartQuits Spyder and starts it again.Alt+Shift+R
QuitExits Spyder from any pane, because the key is registered as a global shortcut.Ctrl+Q

IPython console 7

Spyder's documentation states the Mac form of a shortcut case by case: for a new console it gives Ctrl-T, and Cmd-T on macOS. It prints no full Mac list, which is why this page has a single column.

ActionWindows / Linux
New consoleOpens another console tab with the default settings; the console must have focus.Ctrl+T
Restart kernelRelaunches the console's kernel for a clean session; other open consoles are not affected.Ctrl+.
Remove all variablesClears the namespace of the current console without restarting its kernel.Ctrl+Alt+R
Clear consoleWipes the text shown in the console; the internal console has the same default.Ctrl+L
Clear line or blockDiscards the input typed at the current prompt; also the default in the internal console.Shift+Esc
Switch to next consoleMoves to the console tab after the current one.Alt+Shift+Right
Switch to previous consoleMoves to the console tab before the current one.Alt+Shift+Left

Variables and plots 14

ActionWindows / Linux
Search variable names and typesShows or hides the search box of the Variable Explorer.Ctrl+F
Refresh variablesReloads the Variable Explorer's list from the current console session.Ctrl+R
Copy viewer cellsCopies the cells selected in an array or DataFrame viewer opened from the Variable Explorer.Ctrl+C
Close viewerCloses the focused Variable Explorer viewer window, such as an array or DataFrame editor.Ctrl+W
Copy imagePlaces the plot shown in the Plots pane on the clipboard as a picture.Ctrl+C
Previous plotSelects the plot before the current one in the Plots pane.Ctrl+Page Up
Next plotSelects the plot after the current one in the Plots pane.Ctrl+Page Down
Save plot asSaves the displayed plot to an image file chosen in a dialog.Ctrl+S
Save all plotsWrites every plot held in the Plots pane to disk in one step.Alt+Shift+S
Remove plotDeletes the plot currently displayed from the Plots pane.Ctrl+W
Remove all plotsEmpties the Plots pane; in the Editor the same key closes a split panel.Alt+Shift+W
Zoom in on plotEnlarges the plot shown in the Plots pane.Ctrl++
Zoom out of plotShrinks the plot shown in the Plots pane.Ctrl+-
Fit plots to paneToggles automatic scaling of plots to the size of the Plots pane.Ctrl+0

Notes

Running code in pieces

F5 runs the whole file in the console and F9 runs only the selected lines (or the current line with nothing selected), which is how you test one statement without re-running a slow import. Cells are blocks separated by # %% comments: Ctrl + Enter runs the current cell and stays, Shift + Enter runs it and moves to the next — the Jupyter habit — and Alt + Enter re-runs the last cell that was executed. Shift + F9 runs everything above the current line, Alt + F9 everything from it to the end of the file, and F6 repeats the last file that was run.

Debugging and inspection

A breakpoint on the current line toggles with F12 (Shift + F12 for a conditional one), and Ctrl + F5 starts the file under the debugger. From there Ctrl + F10 executes the current line, Ctrl + F11 steps into a function or method, Ctrl + Shift + F11 runs until it returns, Ctrl + F12 continues to the next breakpoint and Ctrl + Shift + F12 stops debugging. Ctrl + I with the cursor on a name opens its documentation in the Help pane, which is the quickest way to read a NumPy or pandas signature without leaving the editor. Ctrl + Shift + V raises the Variable Explorer, where DataFrames and arrays can be opened in a grid.

Panels and files

Most panes have a Ctrl + Shift shortcut: Ctrl + Shift + E editor, Ctrl + Shift + I IPython console, Ctrl + Shift + G plots, Ctrl + Shift + H help, Ctrl + Shift + X the file browser and Ctrl + Shift + P projects. Ctrl + P opens the file switcher, where typing part of a name finds an open file, and Ctrl + L goes to a line — Ctrl + G is go to definition. Ctrl + D deletes the current line rather than duplicating it — Ctrl + Alt + Page Down duplicates — and Alt + Up and Alt + Down move lines. Comments toggle with Ctrl + 1, not a slash key. F11 is full screen for a laptop.

Questions

What is the difference between F5 and F9?

F5 runs the whole file. F9 runs only the selected text, or the current line if nothing is selected, into the same console.

How do I define a cell?

Insert a comment line starting with # %% in the editor. Everything between two such lines is a cell for Ctrl + Enter and Shift + Enter.

Are the shortcuts the same on macOS?

Not all of them. Spyder's defaults file sets separate macOS values for find next, find previous, go to definition and the Plots pane, and on macOS it builds run cell, code completion, duplicate line and the Ctrl + Tab file switching on a modifier it calls Meta. Elsewhere Spyder's documentation pairs Ctrl with Cmd, for example Ctrl-T with Cmd-T for a new console. Preferences › Keyboard shortcuts shows the list a Mac actually uses.

How do I look up a function's documentation?

Put the cursor on the name and press Ctrl + I. The Help pane shows the docstring, rendered when possible.

Sources and checks

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

6 rows from the earlier version of this page were removed in that check: duplicates, and bindings the documentation does not list or lists differently.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.