Find by Character
The command to quickly navigate to a character in Vim is f
The The FX command does nothing. Vim searches forward for a occurrence of the "X" character, but no matches is found, so the cursor doesn ' t move. The FO command finds an occurrence of the ' o ' character, so the cursor was positioned on top of the first match.
fx
The command does not move the cursor because there is no x character in the paragraph, so the cursor does not move. The fo
command found the character o, so the cursor moves to the first character o .
After using the f
command, ;
You can move the cursor to the next matching character, as follows
In addition, we can also use F t t T ,
the command to move the cursor to a specific character as follows:
F
In contrast to the query direction, move to the front of the f
;
,
t
next matching character and move to the back of the T
previous match character, in contrast to the direction of the move.
These move commands can be used in conjunction with the Delete command d
to quickly delete a specific range of characters, as follows:
First the command navigates to the f,
location ,
, and then removes ,
all characters from the end except the period, so the command is t.
positioned before the character .
. d
represents the deletion.
In general, I tend to use and in f{char}
F{char}
Normal mode when I want to move the cursor quickly within the current line, W Hereas I tend to use the t{char}
and T{char}
character search commands on combination with d{motion}
or c{motion}
.
When you move quickly, you usually use f{char}
commands or F{char}
commands to change the text content t{char}
T{char}
.
[Practical.vim (2012.9)]. DREW.NEIL.TIP49 Study Summary