Reputation: 3230
Three ways that I know of:
triple click anywhere in the line
click line number in gutter
cmd+left move caret to start of the line, then cmd+shift+right
But 1 and 2 involve mouse clicking, 3 is a combo. Any real shortcut for selecting one line?
Upvotes: 10
Views: 8254
Reputation: 4450
shift
+ end
will select the line till the end of the line, so there's always:
home
and then shift
+ end
(on Windows, but Mac is the same I guess?)
Upvotes: 0
Reputation: 71
Since there are already keymaps for moving a line up/down, duplicating a line, and deleting a line, the only other purpose I would select an entire line is for copying to a location too far for moving up/down. So, I use the copy
command (accessibly by default with Command-C
using PyCharm CE 2017.3 on mac), which has the nice behavior of automatically selecting and copy the entire line where the cursor is, as long as no text is currently selected.
Upvotes: 2
Reputation: 23282
I will give a chance to ⌥+↑ It does not do the job at once, but in few clicks it can be very handy.
Upvotes: 4
Reputation: 401877
You can assign a keyboard shortcut to this action: Select Line at Caret.
Also note that Copy/Cut actions will work without any selection and will affect the whole line as if it was selected.
Upvotes: 12