Vim Text Selection Trick
I just learned some techniques from my friend today.
Say we have the following text:
If I wanted to do something with the string within “, I can do it easily with Vim using this pattern in command mode.
The thing to do first is to move the cursor within the “.
Next, follow the above command pattern.
The first set of command <c|v|d|y> indicates the action you want to perform.
- c: for making a change
- v: for selection
- d: for delete
- y: for copy
The second set of command <a|i> indicates the scope of selection.
- a: cover the string between the input character including the input character (“ here).
- i: cover the string between the input character excluding the input character (“ here).
The last one is the character you want, which is “ here.
If you want to select “With” from “stringWithFormat”, you can do it by moving the cursor to “W”,
To quickly move to “W” in the last question, it’s easily done by using