Vim - Delete til last occurrence of character in line

I would use f df...

It is not necessarily shorter to type, but I find it easier to use "repeat last command" than counting in advance the number of word/sentence I want to delete.

Then you can adjust the number of . you type to adjust the length of the string you want to delete.


You can use my JumpToLastOccurrence plugin. It provides ,f / ,F / ,t / ,T commands that do just that.


one way without using regex, without counting "dot" (could be other letters)... see if others have better way..

foo[I]not.relevant.text.bar ([I] is cursor)

you could try:

lmm$T.d`m

or in this format, may look better?

lmm$T.d`m

this will do the job. you could create a mapping if you use that often.

EDIT

I add a GIF animation to show it works. :)

note

I typed @= in normal mode after moving my cursor to the right starting point (by f(space)), to display the keys I pressed in command line.

enter image description here

Tags:

Vim