VIM: how to select a line, up to the cursor, including the char under the cursor?

From normal mode I select what's before the cursor with:

v<Home>

Is adding to the selection what's under the cursor possible?

Thanks!!


Solution 1:

edit

You want to change the direction of the selection, right? Just type o and extend your selection as you need.

lorem ipsum dolor sit amet
        #                  " starting point
<########                  " v^
########>                  " o
##########>                " e

endedit

I'm not exactly sure about what you want so here are a bunch of selection combos.

Select from cursor to first column of the line:

v0

Select from cursor to first printable character of the line:

v^

Select from cursor to end of the line:

v$

Select from cursor to end of the word:

ve

Select from cursor to beginning of the word:

vb

Select from cursor to the next opening parenthesis on the line (inclusive):

vf(

Select from cursor to the previous double quote on the line (exclusive):

vT"

Select from cursor to the next occurence of foo in the buffer (always exclusive):

v/foo<CR>

Select from cursor to previous occurence of bar in the buffer (always exclusive):

v?bar<CR>

Select the whole word under cursor:

viw

Select everything between a pair of parenthesis:

vi( (or vib)

Select the body of a function:

vi{ (or viB)

Select a whole sentence:

vis

Select a whole paragraph:

vip

For even more, see :help motion.txt.