1

I want to essentially be able to use a command similar to dt#, where the # represents any numerical character.

My use case is modifying a script where I have a few server instances with long names that I wanted to abbreviate, from:

instance0
instance1
instance2
instance3

to

i0
i1
i2
i3

Is that possible without a regex? It would be useful to have something similar that includes a way to represent any alpha or symbol too.

2

Placing your cursor on the second character in your string (n), you could use d/\d.

I suppose this does count as regex still, but looking at the documentation of t and f, they both use {char} which does not seem to include character groups or types such as \d represents digits in a regex pattern.

i[n]stance0
instance1
instance2
instance3

d/\d

i0
instance1
instance2
instance3
  • This looks pretty much what I was thinking of! So d/\d uses a forward search to the next digit character as the motion? vimregex.com/#metacharacters – Mike Oct 30 '15 at 10:43
  • 1
    Yup, that is correct! – timss Oct 30 '15 at 10:54
  • Then you can use j.j.j. – SergioAraujo Feb 12 '18 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.