0

I have a config file that have placeholder PKG, in workflow, I need to replace this PKG with a string but typing :%s/blah/blah/g cost time.

I need a quick map key that asks for a string to replace then replace all PKG with that string.

Can vim do that? :)

1 Answer 1

3

Something like this:

nnoremap <KEY> :%s/PKG//g<Left><Left>

It populates the command line with :%s/PKG//g with the cursor between //. You can then simply type the new string and Enter

2
  • I just need that, a wrapper would overkill.
    – Tuyen Pham
    Aug 16, 2018 at 12:13
  • May want to add :keeppatterns to avoid adding /PKG/ to the search history. See :h :keeppatterns Aug 16, 2018 at 14:07

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.