How to select/copy current line without using mouse in IntelliJ IDEA
Asked Answered
E

6

43

To duplicate lines I use

Ctrl + D

Is there a similar way to select/copy current line using keyboard in IntelliJ IDEA?

Endorsed answered 23/7, 2015 at 15:59 Comment(1)
A later duplicate of this Question, with more answers: Select current line in intellijGlynas
G
72

If you have nothing selected, I think you can just hit CTRL-C to copy a line (or CTRL-X to cut it)...

http://grahamhackingscala.blogspot.co.uk/2010/08/fast-quick-line-cut-copy-intellij-idea.html

Hope this helps.

Gaddy answered 23/7, 2015 at 16:5 Comment(2)
I'm astonished even more than you, because this answer is completely useless, if you want to duplicate multiple lines (you'd use ctrl+d, but first you have to select many (how? I think they wanted ctrl+w to be used for this)) and it is the accepted and most voted answer in both places on SO asking this question (the second is here)Frederiksen
Ctrl+C is not copying the line in clion 2018.2.Produce
G
16

CTRL + X CTRL + V

CTRL + D - duplicate line CTRL + Y - delete line

Ganymede answered 11/4, 2017 at 11:48 Comment(2)
FYI, ⌘+d does indeed duplicate a line with the caret (insertion point) on macOS in IntelliJ 2017.3.Glynas
@BasilBourque it will if you set Keymap from Settings to ItelliJ IDEA Classic.Ppm
C
5

In Mac OS ,i would like to keymap :

Command + D (Duplicate Line Or Selection) ==> Command + D (Duplicate Entire Lines)

This can duplicate a/multi line with the caret (insertion point) ,work in IntelliJ 2018.1.

enter image description here

or another way:

copy multiline with the caret (insertion point),not change keymapp, copy extra newline feed hidden "\n": enter image description here

Cosmic answered 8/10, 2018 at 9:21 Comment(0)
E
2

CTRL + C selects the whole line. CTRL + D duplicates the selected line.

Exciter answered 26/9, 2019 at 12:12 Comment(1)
Currently, only Ctrl + D (without selection) is enough to duplicate current line and it is the best option using the default shortcuts of multiples JetBrains IDE. If make a selection make sure to select the whole line, Ctrl + C is the shortcut for that, before hit Ctrl + D. The effect is the same as Alt + Shif + Down Arrow shortcut of VSCode.Etty
P
0

If you go to the specific line rather at the start or positioned at a specific row and column you can use the CTRL + W to select portions of the text depending on its complexity and language.

If you are at the start of the line and you want to select the entire text it's going to require to use CTRL + W 2 times, firstly it's going to select the first character and then the entire row till the end.

Ppm answered 28/9, 2018 at 20:57 Comment(0)
I
0

I find a useful method, using Fn + ← or → to move to the beginning or end of the line, and using Fn + shift + ← or → to select a row.

Infusorian answered 22/7, 2023 at 2:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.