PyCharm 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 PyCharm uses the system Clipboard, you can copy and paste between applications.
So doing, when pasting Clipboard entries, PyCharm 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, PyCharm 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.
PyCharm 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 IDE Settings.
- On the main menu, choose .
- Press Ctrl+C or Ctrl+Insert.
- Click the Copy button
on the toolbar.
The Ctrl+D keyboard shortcut clones a line at the caret or a selected arbitrary fragment of text.
- Open the desired file in the editor, then choose Ctrl+Shift+C. on the main menu or press
- Select the desired file in the Project tool window and choose on the context menu of the selection.
- Open the desired file in the editor.
- Place the caret at a certain line of code.
- Do one of the following:
- On the main menu, choose
- On the context menu of the line at caret, choose
- Press Ctrl+Shift+Alt+C.
PyCharm creates a string in the format that depends on a symbol at caret. For example:
Solver.Solver#discr
for a Python methodSolver\Solver.py:14
for a Python file
- Select the desired fragment in the editor.
-
Do one of the following:
- On the main menu, choose .
- Press Ctrl+X or Shift+Delete.
- Click the Cut button
on the toolbar.
- Place the caret in the location where you want to paste content.
-
Do one of the following:
- On the main menu, choose .
- Press Ctrl+V or Shift+Insert.
- Click the Paste button
on the toolbar.
If you perform paste in a Python 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.
- On the main menu, choose .
- Press Ctrl+Shift+Alt+V.
- On the main menu, choose Ctrl+Shift+V or Ctrl+Shift+Insert. or press
- In the Choose Content to Paste dialog box select the desired entry from the list of recent Clipboard entries, and click OK.