0

I was wondering if there is a way to just remove the selection when I copy a line by doing ctrl + c on a line

before: I just have my cursor in a line:

before

after: I just press ctrl + c

after

I dont like how I have to do an extra step to unselect, there must be a way to just remove the select without removing any functionality. Vscode has it working perfectly but I would love to have the same experience in IntelIJ

2 Answers2

2

You can simply use Ctrl+D to copy a complete line without selecting it.

More info in JetBrains Help

François B.
  • 1,096
  • 7
  • 19
  • Although a nice shortcut (thus my upvote), this is more a short comment unless explanation or links given. – hc_dev Feb 08 '22 at 09:24
0

To just copy and paste the line, you don't need to select it at all.

Just use action Duplicate line or selection Ctrl + D and Move Statement Up/Down Alt+Shift+Up or Alt+Shift+Down to the desired position with .

See JetBrains blog :

Like cut, we can copy a whole line with ⌘C, or Ctrl+C, without having to highlight it first, and paste this too. Sometimes it might be more useful to duplicate the line instead with ⌘D, or Ctrl+D.

When duplicating a line, the line will be copied directly as new line below and cursor is placed where it has been before.

Watch the youtube demo IntelliJ IDEA Tricks - Lecture 7: Duplicate and Delete Lines (0:41)

See also:

hc_dev
  • 8,389
  • 1
  • 26
  • 38