Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable copying entire line when nothing is selected in Intellij

I have recently started using Intellij and I noticed that by default, when you do ctrl+c for copying something when you have nothing selected, it copies the entire line into the clipboard overriding what I had in there before.

This is really annoying yet I cannot seem to figure out how to disable it. I am aware that there is a paste history you can use however this is not what I am after, I just want to disable it like you can do with sublime text.

Is there a way to disable this behaviour so that when I press ctrl+c and nothing is selected it just leaves the clipboard alone?

like image 519
Alexandre Thenorio Avatar asked Oct 01 '15 19:10

Alexandre Thenorio


People also ask

How do I copy a whole line in IntelliJ?

Duplicate the current line or selectionPress Ctrl+D or choose Edit | Duplicate Line or Selection from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.

How do I copy and paste in IntelliJ?

Set the caret anywhere in the line to copy the whole line, or make a selection to copy. Press Ctrl+C or choose Edit | Copy from the main menu .

How do I copy a file in IntelliJ?

Press Alt + Home to activate the navigation bar, then either press F5 , or press Ctrl + C to copy the file and then press Ctrl + V to paste it, a dialog will appear to name your new file.


2 Answers

Since version 2021.2 there is a dedicated Don't copy/cut the current line when invoking the Copy or Cut action with no selection setting for this in Preferences | Advanced Settings.

For older IntelliJ Platform based IDE's the setting is more hidden:

Invoke Help | Find Action... (Ctrl (Cmd on Mac)+Shift+A), type Registry and select the Registry... item that appears. Enable the editor.skip.copy.and.cut.for.empty.selection option there. Be careful with the other configuration options, because it is possible to break your IntelliJ IDEA installation with an incorrect setting.

Registry window

like image 57
Bas Leijdekkers Avatar answered Oct 22 '22 20:10

Bas Leijdekkers


In Mac OS X:

  1. Press cmd+shift+a.
  2. Type registry and press return to open the Registry.
  3. Enable the editor.skip.copy.and.cut.for.empty.selection option.
  4. Click Close.
like image 34
Rob Johansen Avatar answered Oct 22 '22 19:10

Rob Johansen