# Tutorial: Work with code in the editor

This tutorial covers the essential shortcuts and tips for working with code in the editor, which will speed up your workflow.

You will learn how to quickly copy, duplicate, and delete lines, split and join strings, move lines and code statements, and use multiple carets to edit several places at once. In this tutorial, we will explore these features using Java code.

By the end of the tutorial, you will be able to navigate your files and handle routine editing tasks faster using various editor shortcuts.

## Create a new project

Let's create a new project that we will use to complete the tasks of this tutorial.

Procedure:

1. Launch IntelliJ IDEA.

If the Welcome screen opens, click New Project.

Otherwise, go to `File | New Project` in the main menu.

2. In the New Project wizard, select Java from the New Project list.

3. Name the project (for example, `EditorTips`) and change the default location if necessary.

4. Select IntelliJ as the Build system.

5. From the JDK list, select the latest available Oracle OpenJDK version.

If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory.

If you do not have the necessary JDK on your computer, select Download JDK.

6. Leave the Add sample code option disabled. Click Create.

![Creating a new Java project](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-new-project.png)

7. In the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , make sure the `src` folder is selected.

Click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.add.svg) New File or Directory on the tool window toolbar (`Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Ctrl+N` (Visual Studio), `⌘ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS))) and select Java Class.

8. Name the file (for example, `EditorTips`) and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

9. Open the newly created file in the editor and add the following code to it:

```JAVA
public class EditorTips {
    //This is an extra line that needs to be deleted
    public void editorTipsStrings() {
        //Press Enter to insert a line break
        //Press Ctrl+Shift+J (Windows) or ⌃Control+⇧Shift+J (Mac) to join lines
        String multipleLines = "This code can be written on a single line or across multiple lines, " +
                "and you can press to automatically insert a line break with '+' sign.";

        String copyPasteLines = "Let's " +
                "copy this line," +
                "and paste lines before this line." +
                "then cut this line," +
                "This is the end.";

        String duplicateLines = "Let's " +
                "duplicate this line," +
                "and move to the next one.";

        String orderList = "Here is a list of items:" +
                "Item 1" +
                "Item 3" +
                "Item 2" +
                "Item 4";

    }
}
```

Now you have a file which you will use through the entire tutorial.

## Maximize editor pane

To fully focus on working with code, it is useful to maximize the editor pane so that other panes and tool windows do not take up workspace. Let's open the file that we will work with and maximize the editor pane.

Procedure:

1. Open the `EditorTips.java` class file in the editor.

2. Press `Ctrl+Shift+F12` (Windows), `⌘ ⇧ F12` (macOS), `⌘ ⇧ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F12` (macOS System Shortcuts), `Ctrl+Shift+F12` (XWin), `Ctrl+Shift+F12` (GNOME), `Ctrl+Shift+F12` (KDE), `Ctrl+Shift+F12` (Emacs), `Ctrl+Shift+F12` (Sublime Text), `⌘ ⇧ F12` (Sublime Text (macOS)), `Ctrl+Shift+F12` (NetBeans), `Ctrl+Shift+F12` (Visual Studio), `⌘ ⇧ F12` (Visual Studio (macOS)), `Ctrl+Shift+F12` (Eclipse), `⌘ ⇧ F12` (Eclipse (macOS)).

IntelliJ IDEA hides all windows except the active editor.

## Work with lines of code

Procedure: Copy and paste lines

You can use the standard shortcuts to copy `Ctrl+C` (Windows), `⌘ C` (macOS), `⌘ C` (IntelliJ IDEA Classic (macOS)), `⌘ C` (macOS System Shortcuts), `Ctrl+C` (XWin), `Ctrl+C` (GNOME), `Ctrl+C` (KDE), `Ctrl+Insert` (Emacs), `Ctrl+C` (Sublime Text), `⌘ C` (Sublime Text (macOS)), `Ctrl+C` (NetBeans), `Ctrl+C` (Visual Studio), `⌘ C` (Visual Studio (macOS)), `Ctrl+C` (Eclipse), `⌘ C` (Eclipse (macOS)), cut `Ctrl+X` (Windows), `⌘ X` (macOS), `⌘ X` (IntelliJ IDEA Classic (macOS)), `⌘ X` (macOS System Shortcuts), `Ctrl+X` (XWin), `Ctrl+X` (GNOME), `Ctrl+X` (KDE), `Shift+Delete` (Emacs), `Ctrl+X` (Sublime Text), `⌘ X` (Sublime Text (macOS)), `Ctrl+X` (NetBeans), `Ctrl+X` (Visual Studio), `⌘ X` (Visual Studio (macOS)), `Ctrl+X` (Eclipse), `⌘ X` (Eclipse (macOS)) and paste `Ctrl+V` (Windows), `⌘ V` (macOS), `⌘ V` (IntelliJ IDEA Classic (macOS)), `⌘ V` (macOS System Shortcuts), `Ctrl+V` (XWin), `Ctrl+V` (GNOME), `Ctrl+V` (KDE), `Shift+Insert` (Emacs), `Ctrl+Shift+V` (Sublime Text), `⌘ ⇧ V` (Sublime Text (macOS)), `Ctrl+V` (NetBeans), `Ctrl+V` (Visual Studio), `⌘ V` (Visual Studio (macOS)), `Ctrl+V` (Eclipse), `⌘ V` (Eclipse (macOS)) any selected code fragment. If nothing is selected, IntelliJ IDEA automatically copies or cuts the entire line where the caret is located.

1. In `EditorTips.java`, find the `copyPasteLines` variable.

2. Place the caret anywhere on a line you want to copy (for example, `"copy this line," +`) and press `Ctrl+C` (Windows), `⌘ C` (macOS), `⌘ C` (IntelliJ IDEA Classic (macOS)), `⌘ C` (macOS System Shortcuts), `Ctrl+C` (XWin), `Ctrl+C` (GNOME), `Ctrl+C` (KDE), `Ctrl+Insert` (Emacs), `Ctrl+C` (Sublime Text), `⌘ C` (Sublime Text (macOS)), `Ctrl+C` (NetBeans), `Ctrl+C` (Visual Studio), `⌘ C` (Visual Studio (macOS)), `Ctrl+C` (Eclipse), `⌘ C` (Eclipse (macOS)).

3. Move the caret to the line where you want to insert the copied line (for example, `"and paste lines before this line." +`) and press `Ctrl+V` (Windows), `⌘ V` (macOS), `⌘ V` (IntelliJ IDEA Classic (macOS)), `⌘ V` (macOS System Shortcuts), `Ctrl+V` (XWin), `Ctrl+V` (GNOME), `Ctrl+V` (KDE), `Shift+Insert` (Emacs), `Ctrl+Shift+V` (Sublime Text), `⌘ ⇧ V` (Sublime Text (macOS)), `Ctrl+V` (NetBeans), `Ctrl+V` (Visual Studio), `⌘ V` (Visual Studio (macOS)), `Ctrl+V` (Eclipse), `⌘ V` (Eclipse (macOS)).

IntelliJ IDEA pastes the copied line above current position of the caret.

![Copy and paste line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-copy-paste-line.gif)

4. Place the caret on the line you want to cut (for example, `"then cut this line" +`) and press `Ctrl+X` (Windows), `⌘ X` (macOS), `⌘ X` (IntelliJ IDEA Classic (macOS)), `⌘ X` (macOS System Shortcuts), `Ctrl+X` (XWin), `Ctrl+X` (GNOME), `Ctrl+X` (KDE), `Shift+Delete` (Emacs), `Ctrl+X` (Sublime Text), `⌘ X` (Sublime Text (macOS)), `Ctrl+X` (NetBeans), `Ctrl+X` (Visual Studio), `⌘ X` (Visual Studio (macOS)), `Ctrl+X` (Eclipse), `⌘ X` (Eclipse (macOS)).

5. Move the caret to the target line (for example, `"and paste lines before this line." +`) and press `Ctrl+V` (Windows), `⌘ V` (macOS), `⌘ V` (IntelliJ IDEA Classic (macOS)), `⌘ V` (macOS System Shortcuts), `Ctrl+V` (XWin), `Ctrl+V` (GNOME), `Ctrl+V` (KDE), `Shift+Insert` (Emacs), `Ctrl+Shift+V` (Sublime Text), `⌘ ⇧ V` (Sublime Text (macOS)), `Ctrl+V` (NetBeans), `Ctrl+V` (Visual Studio), `⌘ V` (Visual Studio (macOS)), `Ctrl+V` (Eclipse), `⌘ V` (Eclipse (macOS)).

IntelliJ IDEA pastes the cut line.

![Cut and paste line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-cut-paste-line.gif)

> **Tip:**
> IntelliJ IDEA keeps track of everything you copy to the clipboard. To paste from history, right-click in the editor and select `Copy/Paste Special | Paste from History` (`Ctrl+Shift+V` (Windows), `⌘ ⇧ V` (macOS), `⌘ ⇧ V` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ V` (macOS System Shortcuts), `Ctrl+Shift+V` (XWin), `Ctrl+Shift+V` (GNOME), `Ctrl+Shift+V` (KDE), `Alt+Y` (Emacs), `Ctrl+K, Ctrl+V` (Sublime Text), `⌘ K, ⌘ V` (Sublime Text (macOS)), `Ctrl+Shift+V` (NetBeans), `Ctrl+Shift+V` (Visual Studio), `⌘ ⇧ V` (Visual Studio (macOS)), `Ctrl+Shift+V` (Eclipse), `⌘ ⇧ V` (Eclipse (macOS))). In the dialog that opens, select the entry you need and click Paste. To learn more about advanced copy-paste features, refer to [Copy and paste code](working-with-source-code.html#copy_paste).

Procedure: Duplicate a line

You can use the standard shortcut `Ctrl+D` (Windows), `⌘ D` (macOS), `⌘ D` (IntelliJ IDEA Classic (macOS)), `⌘ D` (macOS System Shortcuts), `Ctrl+D` (XWin), `Ctrl+D` (GNOME), `Ctrl+D` (KDE), `Meta+D` (Emacs), `Ctrl+Shift+D` (Sublime Text), `⌘ ⇧ D` (Sublime Text (macOS)), `Ctrl+D` (NetBeans), `Ctrl+D` (Visual Studio), `⌘ D` (Visual Studio (macOS)), `Ctrl+D` (Eclipse), `Ctrl+D` (Eclipse (macOS)) to duplicate any selected code fragment. If nothing is selected, IntelliJ IDEA automatically duplicates the entire line where the caret is located.

1. In `EditorTips.java`, find the `duplicateLines` variable.

2. Place the caret on the line you want to duplicate (for example, `"duplicate this line," +`) and press `Ctrl+D` (Windows), `⌘ D` (macOS), `⌘ D` (IntelliJ IDEA Classic (macOS)), `⌘ D` (macOS System Shortcuts), `Ctrl+D` (XWin), `Ctrl+D` (GNOME), `Ctrl+D` (KDE), `Meta+D` (Emacs), `Ctrl+Shift+D` (Sublime Text), `⌘ ⇧ D` (Sublime Text (macOS)), `Ctrl+D` (NetBeans), `Ctrl+D` (Visual Studio), `⌘ D` (Visual Studio (macOS)), `Ctrl+D` (Eclipse), `Ctrl+D` (Eclipse (macOS)).

IntelliJ IDEA creates an exact copy of the line directly below it.

![Duplicate line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-duplicate-line.gif)

Procedure: Delete a line

In IntelliJ IDEA, you can quickly remove an entire line of code without selecting it first.

1. In `EditorTips.java`, find the line you want to delete (for example, the `//This is an extra line that needs to be deleted` comment).

2. Press `Ctrl+Y` (Windows), `⌘ ⌫` (macOS), `⌘ Y` (IntelliJ IDEA Classic (macOS)), `⌘ ⌫` (macOS System Shortcuts), `Ctrl+Y` (XWin), `Ctrl+Y` (GNOME), `Ctrl+Y` (KDE), `Ctrl+Y` (Emacs), `Ctrl+Shift+K` (Sublime Text), `⌃ ⇧ K` (Sublime Text (macOS)), `Ctrl+E` (NetBeans), `Ctrl+L` (Visual Studio), `⌘ ⇧ L` (Visual Studio (macOS)), `Ctrl+D` (Eclipse), `⌘ D` (Eclipse (macOS)).

IntelliJ IDEA deletes the line and moves the caret to the beginning of the next one.

![Delete an entire line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-delete-line.gif)

Procedure: Split lines

IntelliJ IDEA supports smart splitting for strings. If you press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) in the middle of a string, the IDE automatically closes the quotes on the current line, adds a plus sign (+) for concatenation, and reopens the quotes on the new line.

1. In `EditorTips.java`, find the line you want to split (for example, `String multipleLines`), place the caret where you want the split to begin (for example, before `or across` words), and then press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

IntelliJ IDEA splits the string and moves the caret to the beginning of the new line.

![Split a line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-split-line.png)

2. Sometimes you need to split a string but stay on the current line to continue typing. Let's use the shortcut `Ctrl+Enter` (Windows), `⌘ ⏎` (macOS), `⌘ ⏎` (IntelliJ IDEA Classic (macOS)), `⌃ O` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+O` (Emacs), `Shift+Enter` (Sublime Text), `⇧ ⏎` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `Ctrl+Enter` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)) to split our `multipleLines` string and complete it with the missing name of key.

In the same `multipleLines` variable, place the caret after the `press` word and press `Ctrl+Enter` (Windows), `⌘ ⏎` (macOS), `⌘ ⏎` (IntelliJ IDEA Classic (macOS)), `⌃ O` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+O` (Emacs), `Shift+Enter` (Sublime Text), `⇧ ⏎` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `Ctrl+Enter` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)).

IntelliJ IDEA splits the line but leaves the caret on the current line, right before the closing quotation marks.

3. Type `Enter`.

![Split a line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-smart-split.gif)

The string is now properly formatted and complete.

Procedure: Join lines

In IntelliJ IDEA, you can quickly join lines using a single shortcut. This is helpful for formatting multiple strings or laying out block comments.

1. In `EditorTips.java`, place the caret on the line where you want to join next lines (for example, the first line of the `multipleLines` variable) and press `Ctrl+Shift+J` (Windows), `⌃ ⇧ J` (macOS), `⌃ ⇧ J` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ J` (macOS System Shortcuts), `Ctrl+Shift+J` (XWin), `Ctrl+Shift+J` (GNOME), `Ctrl+Shift+J` (KDE), `Ctrl+Shift+J` (Emacs), `Ctrl+J` (Sublime Text), `⌘ J` (Sublime Text (macOS)), `Ctrl+Shift+J` (NetBeans), `Ctrl+Shift+J` (Visual Studio), `⌃ ⇧ J` (Visual Studio (macOS)), `Ctrl+Shift+J` (Eclipse), `⌃ ⇧ J` (Eclipse (macOS)).

IntelliJ IDEA adds the next line to the end of the current one, removes the concatenation (+) and quotes, merges everything into a single string, and puts the caret at the beginning of the joined part.

2. Keep pressing the shortcut until the entire `multipleLines` variable is joined into one line.

![Join lines in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-join.gif)

## Move the code

Procedure: Move statements

A code statement is a complete instruction, such as a variable assignment or a function call. In IntelliJ IDEA you can move an entire statement through the file with a single shortcut. If a statement spans multiple lines, moving a statement declaration line will move the entire block.

1. In the editor, place the caret inside the code statement you want to move (for example, the `copyPasteLines` variable declaration).

2. Press `Ctrl+Shift+Up` (Windows), `⌘ ⇧ ↑` (macOS), `⌘ ⇧ ↑` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ ↑` (macOS System Shortcuts), `Ctrl+Shift+Up` (XWin), `Ctrl+Shift+Up` (GNOME), `Ctrl+Shift+Up` (KDE), `Ctrl+Shift+Up` (Emacs), `Ctrl+Shift+Up` (Sublime Text), `⌘ ⇧ ↑` (Sublime Text (macOS)), `Alt+Shift+Page Up` (NetBeans), `Ctrl+Alt+Shift+Up` (Visual Studio), `⌃ ⌥ ⇧ ↑` (Visual Studio (macOS)), `Alt+Up` (Eclipse), `⌥ ↑` (Eclipse (macOS)) to move a statement up or `Ctrl+Shift+Down` (Windows), `⌘ ⇧ ↓` (macOS), `⌘ ⇧ ↓` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ ↓` (macOS System Shortcuts), `Ctrl+Shift+Down` (XWin), `Ctrl+Shift+Down` (GNOME), `Ctrl+Shift+Down` (KDE), `Ctrl+Shift+Down` (Emacs), `Ctrl+Shift+Down` (Sublime Text), `⌘ ⇧ ↓` (Sublime Text (macOS)), `Alt+Shift+Page Down` (NetBeans), `Ctrl+Alt+Shift+Down` (Visual Studio), `⌃ ⌥ ⇧ ↓` (Visual Studio (macOS)), `Alt+Down` (Eclipse), `⌥ ↓` (Eclipse (macOS)) to move it down.

IntelliJ IDEA moves the statement while performing a syntax check to ensure it stays within the method.

3. Move the selected code statement to the end of the method.

![Move the whole statement in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-move-statement.gif)

> **Note:**
> If moving of the statement is not allowed in the current context, the actions will be disabled.

To learn more about working with code statements, refer to [Code statements](working-with-source-code.html#editor_statement_select).

Procedure: Move lines

You can also move a single or multiple lines regardless of the code syntax.

1. In the editor, place the caret on the line you want to move (for example, the `Item 2` string in the `orderList` variable).

2. Press `Alt+Shift+Up` (Windows), `⌥ ⇧ ↑` (macOS), `⌥ ⇧ ↑` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ ↑` (macOS System Shortcuts), `Alt+Shift+Up` (XWin), `Alt+Shift+Up` (GNOME), `Alt+Shift+Up` (KDE), `Alt+Shift+Up` (Emacs), `Ctrl+Shift+Up` (Sublime Text), `⌘ ⌃ ↑` (Sublime Text (macOS)), `Alt+Shift+Up` (NetBeans), `Alt+Shift+Up` (Visual Studio), `Alt+Shift+Up` (Visual Studio (macOS)), `Alt+Shift+Up` (Eclipse), `Alt+Shift+Up` (Eclipse (macOS)) to move the line up or `Alt+Shift+Down` (Windows), `⌥ ⇧ ↓` (macOS), `⌥ ⇧ ↓` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ ↓` (macOS System Shortcuts), `Alt+Shift+Down` (XWin), `Alt+Shift+Down` (GNOME), `Alt+Shift+Down` (KDE), `Alt+Shift+Down` (Emacs), `Ctrl+Shift+Down` (Sublime Text), `⌘ ⌃ ↓` (Sublime Text (macOS)), `Alt+Shift+Down` (NetBeans), `Alt+Shift+Down` (Visual Studio), `Alt+Shift+Down` (Visual Studio (macOS)), `Alt+Shift+Down` (Eclipse), `Alt+Shift+Down` (Eclipse (macOS)) to move it down.

IntelliJ IDEA moves the line without performing a syntax check.

3. Use these shortcuts to fix the order of items in the `orderList` variable.

![Move a line in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-move-line.gif)

## Work with multiple carets and selection ranges

When typing, copying, or pasting in IntelliJ IDEA editor, you can toggle multiple cursors so that your actions apply in several places simultaneously.

Procedure: Add multiple carets

You can add the same text in several places at once using multiple carets. For example, you can quickly add all missing spaces in several strings at the same time.

1. In the editor, place the caret where you want to add content (for example, after the `duplicate this line,` text inside quotes).

2. Use `Alt+Shift+Click` (Windows), `⌥ ⇧ Click` (macOS), `⌥ ⇧ Click` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ Click` (macOS System Shortcuts), `Alt+Shift+Click` (XWin), `Alt+Shift+Click` (GNOME), `Alt+Shift+Click` (KDE), `Alt+Shift+Click` (Emacs), `Ctrl+Click` (Sublime Text), `⌘ Click` (Sublime Text (macOS)), `Alt+Shift+Click` (NetBeans), `Ctrl+Alt+Click` (Visual Studio), `⌥ ⇧ Click` (Visual Studio (macOS)), `Alt+Shift+Click` (Eclipse), `⌥ ⇧ Click` (Eclipse (macOS)) at other locations to add additional carets. Place carets before all places with missing spaces.

3. Press `Space` to type spaces.

IntelliJ IDEA inserts a typed text at every caret position simultaneously.

![Add multiple carets in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-add-multiple-carets.gif)

4. Press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)) to remove all extra carets, leaving only the most recent one.

Procedure: Use column selection mode

Column selection mode allows you to edit code in a rectangular block rather than a continuous flow. It is useful for modifying lists or structured data quickly.

Let's add markers to our list using column selection mode.

1. In the main menu, go to `Edit | Column Selection Mode` (`Alt+Shift+Insert` (Windows), `⌘ ⇧ 8` (macOS), `⌘ ⇧ 8` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ 8` (macOS System Shortcuts), `Alt+Shift+Insert` (XWin), `Alt+Shift+Insert` (GNOME), `Alt+Shift+Insert` (KDE), `Alt+Shift+Insert` (Emacs), `Alt+Shift+Insert` (Sublime Text), `⌘ ⇧ 8` (Sublime Text (macOS)), `Alt+Shift+Insert` (NetBeans), `Alt+Shift+Insert` (Visual Studio), `⌘ ⇧ 8` (Visual Studio (macOS)), `Alt+Shift+Insert` (Eclipse), `⌘ ⇧ 8` (Eclipse (macOS))) to toggle column selection mode.

2. Place the caret inside the quotes before one of the items in the `orderList` variable (for example, before `Item 2`).

3. Press `Shift+Up` (Windows), `⇧ ↑` (macOS), `⇧ ↑` (IntelliJ IDEA Classic (macOS)), `⇧ ↑` (macOS System Shortcuts), `Shift+Up` (XWin), `Shift+Up` (GNOME), `Shift+Up` (KDE), `Shift+Up` (Emacs), `Shift+Up` (Sublime Text), `⇧ ↑` (Sublime Text (macOS)), `Shift+Up` (NetBeans), `Shift+Up` (Visual Studio), `⇧ ↑` (Visual Studio (macOS)), `Shift+Up` (Eclipse), `⇧ ↑` (Eclipse (macOS))/`Shift+Down` (Windows), `⇧ ↓` (macOS), `⇧ ↓` (IntelliJ IDEA Classic (macOS)), `⇧ ↓` (macOS System Shortcuts), `Shift+Down` (XWin), `Shift+Down` (GNOME), `Shift+Down` (KDE), `Shift+Down` (Emacs), `Shift+Down` (Sublime Text), `⇧ ↓` (Sublime Text (macOS)), `Shift+Down` (NetBeans), `Shift+Down` (Visual Studio), `⇧ ↓` (Visual Studio (macOS)), `Shift+Down` (Eclipse), `⇧ ↓` (Eclipse (macOS)) to add new carets above or below the current one. Press shortcuts to place carets at the beginning of each string with list items.

4. Type a hyphen (`-`). IntelliJ IDEA inserts a typed text at every caret position simultaneously.

![Type text in column selection mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-column-selection-mode.gif)

5. Press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)) to remove all extra carets, leaving only the recently added one.

6. In the main menu, go to `Edit | Column Selection Mode` (`Alt+Shift+Insert` (Windows), `⌘ ⇧ 8` (macOS), `⌘ ⇧ 8` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ 8` (macOS System Shortcuts), `Alt+Shift+Insert` (XWin), `Alt+Shift+Insert` (GNOME), `Alt+Shift+Insert` (KDE), `Alt+Shift+Insert` (Emacs), `Alt+Shift+Insert` (Sublime Text), `⌘ ⇧ 8` (Sublime Text (macOS)), `Alt+Shift+Insert` (NetBeans), `Alt+Shift+Insert` (Visual Studio), `⌘ ⇧ 8` (Visual Studio (macOS)), `Alt+Shift+Insert` (Eclipse), `⌘ ⇧ 8` (Eclipse (macOS))) again to disable column selection mode and return to the default editing mode.

Procedure: Clone carets

In IntelliJ IDEA, you can also clone your caret to the lines above or below. Let's add line break characters to our list using this feature.

1. In the editor, place the caret at the first place where you want to add content (for example, before `- Item 1`).

2. Press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and hold it down on the second press. While holding the key, press up or down arrow keys.

If [column selection mode](#use-column-selection-mode) is enabled, new carets will be added exactly above or below the current caret position. Otherwise, if a line is shorter than the current position, the cloned caret will move to the end of that line.

3. Type `\n`. IntelliJ IDEA inserts a typed text at every caret position simultaneously.

![Clone carets in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-clone-carets.gif)

4. Press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)) to remove all extra carets, leaving only the recently added one.

Procedure: Select multiple occurrences of the text

You can select and edit all matching words in a file one by one or simultaneously.

1. Place the caret at a word you want to select (for example, `Item`).

2. Do one of the following:

* Press `F3` (Windows), `⌘ G` (macOS), `F3` (IntelliJ IDEA Classic (macOS)), `⌘ G` (macOS System Shortcuts), `F3` (XWin), `F3` (GNOME), `F3` (KDE), `F3` (Emacs), `F3` (Sublime Text), `⌘ G` (Sublime Text (macOS)), `F3` (NetBeans), `F3` (Visual Studio), `F3` (Visual Studio (macOS)), `Ctrl+K` (Eclipse), `⌘ K` (Eclipse (macOS)) to find and select the next occurrence of matching word or text range.

* Press `Alt+J` (Windows), `⌃ G` (macOS), `⌃ G` (IntelliJ IDEA Classic (macOS)), `⌃ G` (macOS System Shortcuts), `Alt+J` (XWin), `Alt+J` (GNOME), `Alt+J` (KDE), `Alt+J` (Emacs), `Ctrl+D` (Sublime Text), `⌘ D` (Sublime Text (macOS)), `Alt+J` (NetBeans), `Alt+Shift+.` (Visual Studio), `⌥ ⇧ .` (Visual Studio (macOS)), `Alt+Y` (Eclipse), `⌃ G` (Eclipse (macOS)) to find and add to current selection the next occurrence of matching word or text range.

* Press `Ctrl+Alt+Shift+J` (Windows), `⌘ ⌃ G` (macOS), `⌘ ⌃ G` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ G` (macOS System Shortcuts), `Ctrl+Alt+Shift+J` (XWin), `Ctrl+Alt+Shift+J` (GNOME), `Ctrl+Alt+Shift+J` (KDE), `Ctrl+Alt+Shift+J` (Emacs), `Alt+F3` (Sublime Text), `⌘ ⌃ G` (Sublime Text (macOS)), `Ctrl+Alt+Shift+J` (NetBeans), `Alt+Shift+;` (Visual Studio), `⌥ ⇧ ;` (Visual Studio (macOS)), `Ctrl+Alt+Y` (Eclipse), `⌘ ⌃ G` (Eclipse (macOS)) to select all matching words or text ranges in the file.

3. Using multiple selections, replace some or all the occurrences of the word with another text.

Find next:

![Find the next occurrence of the text in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-find-next.gif)

Add selection for next:

![Find the next occurrence of the text in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-select-next.gif)

Select all:

![Find the next occurrence of the text in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor-tips-select-all.gif)

To learn more about working with multiple carets and selection ranges, refer to [Multiple cursors and selection ranges](multicursor.html).

## Summary

In this tutorial, you have learned how to:

* [Maximize editor pane](#maximize-editor-pane)

* [Copy and paste](#copy-paste-line), [duplicate](#duplicate-line), and [delete lines](#delete-line).

* [Split](#split-line) and [join lines](#join-line).

* [Move code statements](#move-statements) and [lines](#move-lines).

* [Work with multiple carets and selection ranges](#work-with-multiple-carets-and-selection-ranges)

## Next steps

Learn how to set up your environment and create simple applications in IntelliJ IDEA from these tutorials:

* [Tutorial: Customize Editor](customize-editor.html)

* [Create your first Java application](creating-and-running-your-first-java-application.html)

* [Tutorial: Run a Java application](run-java-applications.html)

* [Tutorial: Debug your first Java application](debugging-your-first-java-application.html)

* [Tutorial: Getting started with Git in IntelliJ IDEA](working-with-git-tutorial.html)

For a full list of available tutorials, refer to [IntelliJ IDEA tutorials](instance-tutorials.html).

## See also

### Related

[Editor basics](using-code-editor.html) [Write and edit source code](working-with-source-code.html) [Multiple cursors and selection ranges](multicursor.html)

