Friday, October 25, 2013

The Wonderful "F" Key

If you press the "f" key in normal mode, Vim will move the cursor forward to whatever character you input after "f" is pressed. As an example, consider the following line:

a quick brown fox

If the cursor was at the absolute beginning of the line, and you pressed "fb" in normal mode, Vim would move the cursor so that it was positioned over the "b" in "brown".

If you press "F", Vim will move the cursor backwards instead of forward. Given the previous sentence, if pressed "Fq", and the cursor was at the end of the line, it would move to the "q" in "quick".

1 comment:

Sundar said...

'f' is good, but practically I find myself using the related 't' much more. 't' stands for "till", and it takes you till the character you type after it - i.e., to the place just before it. In conjunction with another command, you'd use it like: ct: to "change till the next : character", leaving the colon intact.