Cutting, Copying and Pasting
On this page:
- Basics
- Copying a Selected Fragment of Text
- Copying the path to a file
- Copying the reference to a line or a symbol
- Cutting a selected fragment of text
- Pasting the last entry from the clipboard
- Pasting the last entry from the clipboard as plain text
- Pasting a specific entry from the clipboard
Basics
CLion provides a number of handy Clipboard operations. You can copy, cut, and paste selected text, a path to a file, or a reference to a symbol or a line of code.
Because CLion uses the system Clipboard, you can copy and paste between applications.
So doing, when pasting Clipboard entries, CLion removes any formatting from the text
and any special symbols from the String
values.
The Paste command smartly understands what is being inserted. If you paste a reference to a symbol, it is analyzed for possible imports, references, etc. So doing, CLion provides the necessary brackets and places the caret at the appropriate insertion point. The Paste Simple command helps paste any Clipboard entry as a plain text, without any analysis.
CLion enables Clipboard stacking, which means that you can store multiple Clipboard entries and access them with a single shortcut. The number of entries that can be kept in the Clipboard stack is customizable on the Editor page of the Settings/Preferences dialog.
Copying a Selected Fragment of Text
Do one of the following:
Note that the Ctrl+D keyboard shortcut clones a line at the caret or a selected arbitrary fragment of text.
Copying the path to a file
Do one of the following:
- Open the desired file in the editor, then choose on the main menu or press Ctrl+Shift+C.
- Select the desired file in the Project tool window and choose on the context menu of the selection.
Copying the reference to a line or a symbol
- Open the desired file in the editor.
- Place the caret at a certain line of code.
- Do one of the following:
CLion creates a string in the format that depends on a symbol at caret. For example:
main.cpp:6
Cutting a selected fragment of text
- Select the desired fragment in the editor.
- Do one of the following:
Pasting the last entry from the clipboard
- Place the caret in the location where you want to paste content.
- Do one of the following:
If you perform paste in a C/C++ file, the further behavior depends on the settings in the Auto Import page of the Editor options. If the Ask option has been selected, select the necessary imports from the list of missing imports. In all other cases, the last clipboard entry is pasted silently.
Pasting the last entry from the clipboard as plain text
Do one of the following:
Pasting a specific entry from the clipboard
- On the main menu, choose or press Ctrl+Shift+V.
- In the Choose Content to Paste dialog box select the desired entry from the list of recent Clipboard entries, and click OK.
The depth of the Clipboard stack is configured in the Limits section on the Editor page of the Settings dialog box. When the specified number is exceeded, the oldest entry is removed from the list.