EDIT: The issue wasn't related to whitespace, rather it was my lack of understanding of how region selection works. The selected answer answers the question clearly.
I'm basically looking for the same behavior as V
in VIM so that I can visually select code/text. C-<spc>
seems to be the answer for this. However, if I try to do this with some blocks of code it does not work as expected.
Example. Consider the simple function below.
def thingy():
return 1
If the "point" or "cursor" is on the beginning of the 1st line and you type C-<spc> C-n C-n
you will highlight both lines. However, if you try to do the same thing but start on line 2 and go C-<spc> C-p
it will only highlight the 1st line and will skip the 2nd line - the one that we started on.
As far as I understand this is due to the whitespace that preceeds return 1
.
So what is the recommended way around this?
I know I could try C-<spc> C-e C-n
but this also doesn't work since the highlighed line also skips the current line (line 2).
To me it seems as though this would be solved if I knew how to highlight the line that my "point" is on without having to move to either the start or end of the line and then use C-<spc>
. Then I could C-n
or C-p
and still include the line I started on. But C-<spc>
doesn't seem to do this unfortunately.