Handle caret and select text
You can click the mouse in the editor to set the caret to the desired position and drag the mouse to select a continuous text block.
By default, you can only set 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 Ctrl+Alt+S to be able to set your 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.
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 Ctrl+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 Ctrl+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 | Ctrl+Left Ctrl+Right | 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 Ctrl+Alt+S, the caret will move to the next/previous capitalized word inside identifiers with CamelCase names. Note that by default, on Ctrl+Right 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 | Ctrl+Shift+M | When the caret is right before or after a brace or a bracket, jump to the brace or bracket that matches it. |
Move Caret to Code Block Start Move Caret to Code Block End | Ctrl+[ Ctrl+] | Move the caret to the opening/closing brace of the enclosing code block. |
Next Method Previous Method | Alt+Down Alt+Up | 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 | Ctrl+Page Up Ctrl+Page Down | Move the caret to the top/bottom line of the currently visible editor area, without scrolling. |
Page Up Page Down | Page Up Page Down | 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 | Ctrl+Home Ctrl+End | Move the caret to first/last character in the current document. |
Select text
Command | How to invoke | Use it to |
---|---|---|
Select All | Ctrl+A | Select all text in the active editor tab |
Left with Selection Right with Selection | Shift+Left Shift+Right | 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 | Ctrl+Shift+Left Ctrl+Shift+Right | 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 Ctrl+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 | Ctrl+Shift+[ Ctrl+Shift+] | Make a selection from the current caret position to the opening/closing brace of the enclosing code block. |
Select Containing Declaration | Ctrl+Alt+Shift+[ | Select the entire declaration of the containing member, type, or namespace. |
Up with Selection Down with Selection | Shift+Up Shift+Down | 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 | Ctrl+Shift+Page Up Ctrl+Shift+Page Down | 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+Page Up Shift+Page Down | 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 | Ctrl+Shift+End | Make a selection from the current caret position to to the beginning/end of the current document. |
Extend Selection | Ctrl+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 Ctrl+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 | Ctrl+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, see Structural navigation with Tab and Shift+Tab. |