@rossijonas posted on twitter:
#vim ⌨️ hot tip!
You can use Shell values inside :substitute command
Example:
To substitute ‘mydir’ by the present working directory
:s/mydir/\=expand($PWD)/g
Useful links & references:
- Original post on twitter
- Vim Documentation (
:help
) - “Mastering Vim Quickly” Book (and screencasts) by Jovica Ilic. It’s an awesome book, make sure you subscribe to the newsletter to get free Vim tips and book excerpts on your email.
(👆 This is an affiliate link. If you got any value from this post and are also interested in buying the MVQ book/screencasts, please consider visiting the affiliate link and you’ll be gifting me a coffee ☕ or a beer 🍺.)
Footnotes:
- Follow me on Twitter to get more posts like this and other quick tips in your feed.
- alldrops.info is the TRUE and FOREVER FREE home for the previously used medium.com/vim-drops publication. At alldrops.info you’ll always find all posts without Medium.com restrictions.
- If you have any doubts or tips about this article, I’d appreciate knowing and discussing it via email.
- Do you have any other Vim tips? Would you like to publish that in this blog? Please send an email to vim drops.
- As English is not my native language, I apologize for the errors. Corrections are welcome.
- Contact: vim [@] alldrops [.] info.