0

I have the following string, where I want to change the number "merged_boris_20220712.boris". If instead of underscores it had dashes, I would just go to the numbers and do ciw and type the new number, but underscore are part of word so this doesn't work here. What would be an efficient solution here?

4
  • 1
    Probably f2ct. or f2cw should work (the latter assuming . is not in iskeyword). Do either work for you? Depending on the edit, C-x/C-a are options
    – D. Ben Knoble
    Aug 9, 2022 at 13:20
  • I actually used the latter and made a mental note to not rely on isomething so much :)
    – fbence
    Aug 9, 2022 at 13:27
  • I have been using this since forever. See if it helps.
    – 3N4N
    Aug 9, 2022 at 14:16
  • 1
    Oh you wanted to change between _ and .. I misunderstood. Never mind.
    – 3N4N
    Aug 9, 2022 at 14:17

1 Answer 1

1

Either of f2ct. or f2cw should work (the latter assuming . is not in iskeyword). Depending on the edit, Ctrl-x and Ctrl-a are also options.

Another: /\d\+Entercgn. There is no binding for cd, so you could do

:nnoremap cd /\d\+<enter>cgn

to make cd change the next (whole) number.

1
  • thanks, also learned about gn today
    – fbence
    Aug 9, 2022 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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