⇧⌘A / Ctrl+Shift+A).
Carets and selections
- Clone Caret Above / Below: press the modifier twice and hold it, then press the arrow key.
- Add Selection for Next Occurrence selects the word at the caret first, then adds the next match on every press. When nothing more is found, a hint appears; press again to continue from the top of the file.
- Drag with
⌥/Altheld (or with the middle mouse button on macOS and Windows) to make a rectangular selection without switching modes. - Extend Selection grows the selection to the enclosing word, expression, statement and block, using the syntax tree.
Editing lines and code
Edit › Sort Lines and Edit › Reverse Lines reorder the selected lines; they have no default shortcut.
Brackets and quotes are paired as you type, and typing a quote or bracket over a selection surrounds it. These and other typing aids (smart Home, Tab out of a closing bracket, smart indent on Enter, documentation comment stubs, what Backspace does with indentation, reformat on paste) are under Settings › Editor › General › Smart Keys.
Clipboard
Paste from History… lists the last 30 pieces of text you copied or cut in the window, newest first. Pick one with
↵ / Enter; ⌫ / Delete removes the selected entries. The history lives in memory and is cleared when the window closes.
Copying from the editor puts rich text (with syntax colours) on the clipboard as well; turn this off in Settings › Editor › General › Rich-Text Copy.
Folding
All folding commands are also in Code › Folding. Fold regions come from the language’s syntax and from region comments; Custom Folding… jumps to one of the file’s custom regions. Choose what is folded when a file opens (file header, imports, documentation comments) in Settings › Editor › General › Code Folding.
Formatting
Reformat Code formats the selection, or the whole file when nothing is selected, as one undo step. The formatting comes from the file’s language server or from the formatter the language is configured with (for example Ruff for Python, Prettier or oxfmt for web languages; find their commands as Reformat with … in Find Action). Reformat File… also lets you choose the scope and optimize imports.
Indentation and other style options are under Settings › Editor › Code Style, with a page per language.
.editorconfig files in the project are read too.
To format on every save, enable Reformat code (and optionally Optimize imports) in Settings › Tools › Actions on Save. Trailing spaces and the final line break on save are set in Settings › Editor › General, section Save Files.
Tabs
Window › Editor Tabs also has Pin Tab, Close Other Tabs, Close All Tabs and Reopen Closed Tab, all without default shortcuts. Window › Move Tab to New Window detaches the current tab into its own window.
Tab placement, the tab limit and what happens when it is reached, the preview tab, sorting, and which tab is activated after one closes are set in Settings › Editor › General › Editor Tabs.
Split editors
Window › Editor Tabs also offers Split Down, Unsplit, Unsplit All, Move to Opposite Group, Open in Opposite Group and Change Splitter Orientation. You can also drag a tab to an edge of the editor area to split it.
View options
- View › Active Editor › Soft-Wrap wraps long lines in the current editor. To wrap some file types by default, use Settings › Editor › General, section Soft Wraps.
- View › Reset Font Size in All Editors undoes font zoom. Changing the font size with
⌘/Ctrl+ mouse wheel can be turned on in Settings › Editor › General, section Mouse Control. - View › Appearance › Enter Distraction Free Mode hides tool windows, tabs, the status bar and the gutter and centres the text. Run the same command again to leave.
- Line numbers, whitespace, indent guides, caret style and the intention bulb are in Settings › Editor › General › Appearance. Breadcrumbs and sticky lines (the enclosing declarations pinned at the top while you scroll) have their own pages under Settings › Editor › General.
Saving
As in IntelliJ IDEA, there is no per-file save: files are saved when you switch to another application or to the built-in terminal, and File › Save All (⌘S / Ctrl+S) saves everything at once. Settings › Appearance & Behavior › System Settings, section Autosave, can also save after the IDE has been idle for a while.
Changes made outside the IDE are picked up when you switch back to its window. Reload from Disk (⌥⌘Y / Ctrl+Alt+Y) reloads the current file now.
Related
- Code intelligence: completion, navigation and documentation.
- Live templates and macros
- Vim mode