I understand that vi has shortcut keys to delete characters, words and lines with various options.
However, I could not find this:
- delete from the cursor to the next specified character
For example, I might type du"
expecting the editor to "delete until the next "
character is found"
The closest I know is d9w
where 9
is the number of words to delete.
Does anyone know if this is possible?
Best Answer
Use dtc, where c is any character, e.g. for you, you want dt"
This will delete upto but not including c.
If you had:
And the cursor was at the first space and you typed dt!, you would get:
Also dfc.
This will delete upto and including c.
Using df! on the same example above would give you:
Just about any "motion" can be used for the
d
,c
,y
and similar commands.