Handle caret and select text
You can click the mouse in the editor to place the caret to the desired position and drag the mouse to select a continuous text block.
By default, you can only place the caret at characters, whitespaces, and tabs in the current document. Optionally, you can select Allow placement of caret after end of line on the Editor | General page of the IDE settings Control+Alt+S to be able to place the caret anywhere after the last character in any line. As soon as you start typing at a position beyond the end of the line, the necessary number of spaces will be added between the end of the line and the beginning of your input.
You can double-click an identifier or a word in a comment or plain text to select it.
After double-clicking, you can drag the mouse to make the selection snap to entire words.
For identifiers, you can opt not to select the whole CamelCased identifier, but only the capitalized word inside it where you double-click. To do so, select Honor "CamelHumps" word on the Editor | General page of the IDE settings Control+Alt+S.
Apart from the mouse, you can use keyboard shortcuts to speed up editor navigation and selection operations. The most handy commands and their shortcuts are listed in the tables below.
If you want to change the shortcut for some command, find this command on the Keymap page of the IDE settings Control+Alt+S, and use the context menu to add or remove shortcuts.
Move caret
Command | How to invoke | Use it to |
---|---|---|
Move Caret to Previous Word Move Caret to Next Word | Control+ArrowLeft Control+ArrowRight | Move the caret to the beginning/end of the current word, and then further word by word in the same direction. If Use CamelHumps is selected on the Editor | General | Typing Assistance page of the IDE settings Control+Alt+S, the caret will move to the next/previous capitalized word inside identifiers with CamelCase names. Note that by default, on Control+ArrowRight the caret jumps to the end of the current word. This behavior is configurable in the Caret Movement section on the settings page. |
Move Caret to Line Start Move Caret to Line End | Home End | Move the caret to the first/last character on the current line. |
Go to Containing Declaration | Alt+Shift+[ | Move the caret to the declaration of a type or a function from any position within its body. |
Move Caret to Matching Brace | Control+Shift+M | When the caret is right before or after a brace, a bracket, or HTML/XML tag, jump to the item that matches it. |
Move Caret to Code Block Start Move Caret to Code Block End | Control+[ Control+] | Move the caret to the opening/closing brace of the enclosing code block. |
Next Method Previous Method | Alt+ArrowDown Alt+ArrowUp | Move the caret to the declaration of the next/previous member in the current type. |
Move Caret to Page Top Move Caret to Page Bottom | Control+PageUp Control+PageDown | Move the caret to the top/bottom line of the currently visible editor area, without scrolling. |
Page Up Page Down | PageUp PageDown | Move the caret up/down to the current height of the editor area and scroll the document accordingly, and then further with the same step in the same direction. |
Move Caret to Text Start Move Caret to Text End | Control+Home Control+End | Move the caret to first/last character in the current document. |
Select text
Command | How to invoke | Use it to |
---|---|---|
Select All | Control+A | Select all text in the active editor tab |
Left with Selection Right with Selection | Shift+ArrowLeft Shift+ArrowRight | Extend the selection from the current caret position to one character on the left/right. |
Move Caret to Previous Word with Selection Move Caret to Next Word with Selection | Control+Shift+ArrowLeft Control+Shift+ArrowRight | Make a selection from the current caret position to the beginning/end of the current word, and then extend the selection word by word in the same direction. If Use CamelHumps is selected on the Editor | General | Typing Assistance page of the IDE settings Control+Alt+S, the selection will extend to the to the next/previous capitalized word inside identifiers with CamelCase names. |
Move Caret to Line Start with Selection Move Caret to Line End with Selection | Shift+Home Shift+End | Make a selection from the current caret position to the beginning/end of the current line. |
Move Caret to Code Block Start with Selection Move Caret to Code Block End with Selection | Control+Shift+[ Control+Shift+] | Make a selection from the current caret position to the opening/closing brace of the enclosing code block. |
Select Containing Declaration | Control+Alt+Shift+[ | Select the entire declaration of the containing member, type, or namespace. |
Up with Selection Down with Selection | Shift+ArrowUp Shift+ArrowDown | Make a selection from the current caret position to the same or the nearest column in the next/previous line, and then extend the selection in the same way in the same direction. Note that if the column selection mode is enabled, these shortcuts will add new carets instead of extending selection. |
Move Caret to Page Top with Selection Move Caret to Page Bottom with Selection | Control+Shift+PageUp Control+Shift+PageDown | Make a selection from the current caret position to to the top/bottom of the currently visible editor area, without scrolling. |
Page Up with Selection Page Down with Selection | Shift+PageUp Shift+PageDown | Select the number of lines that corresponds to the editor height, up/down from the current caret position and scroll the document accordingly, and then extend the selection to the same number of lines in the same direction. |
Move Caret to Text Start with Selection Move Caret to Text End with Selection | Control+Shift+End | Make a selection from the current caret position to to the beginning/end of the current document. |
Extend Selection | Control+W | Select the word at the caret and then extend the selection to containing logical blocks of code (for example, an expression, a conditional block, a method body, a class, and so on). If Use CamelHumps is selected on the Editor | General | Typing Assistance page of the IDE settings Control+Alt+S, the first invocation of the command will not select the whole CamelCased identifier, but only the capitalized word inside it where the caret is. |
Shrink Selection | Control+Shift+W | Shrink the selection after your extended it with Extend Selection. The command works in the reverse order (from the outermost containing block to the word at caret). |
Structural navigation forward Structural navigation backward | Tab Shift+Tab | Move the selection to the next/previous logical code element. For more information, refer to Structural navigation with Tab and Shift+Tab. |