Background/Situation
When copying code from IntelliJ‑based IDEs (for example, Rider) and pasting it into external editors like Notepad++, the pasted text can contain unwanted leading tabs or indentation after the first column. This happens because the editor copies the full line, including its existing indentation.
Question
How to copy code from IntelliJ‑based IDEs to external editors (for example, Notepad++) without extra leading tabs or indentation after the first column?
Answer
Use Column Selection Mode in the editor to select a rectangular block of text starting from the column where the actual code begins (excluding leading tabs/spaces). Copying this columnar selection and pasting it into an external editor preserves only the selected columns and prevents additional leading tabs from appearing.
Example
Scenario: Copying code from Rider into Notepad++ without carrying over the leading tabs that shift the pasted code to the right.
- Open the code in Rider (or any IntelliJ‑based IDE). Place the caret at the first character of the code you want to copy, not at the beginning of the line (so you skip leading tabs/spaces).
- Enable Column Selection Mode.
Use one of the following options (all IntelliJ‑based IDEs share these actions):
-
Press Alt+Shift+Insert, or
-
From the main menu, choose Edit | Column Selection Mode, or
-
Right‑click in the editor and select Column Selection Mode from the context menu.
-
- Select the code block as a column.
-
With column selection mode enabled, drag the mouse (or use Shift + arrow keys) to select a rectangular block of code starting from your caret column.
-
Make sure the selection horizontally covers the longest line you want to include.
-
Anything to the left of your starting column (the unwanted tabs) remains unselected and will not be copied.
-
- Copy and paste into Notepad++ or another editor.
-
Press Ctrl+C to copy the column selection.
-
Switch to Notepad++ and press Ctrl+V to paste. The pasted block keeps the same relative indentation between lines but does not include the original leading tabs you excluded in the selection.
-
- Exit Column Selection Mode if needed.
- Press Alt+Shift+Insert again, or
- Use Edit | Column Selection Mode to return to normal selection behavior.
This workflow works in Rider and all other IntelliJ‑based IDEs that support Column Selection Mode.
Comments
0 comments
Please sign in to leave a comment.