
Follow @learnvim for more Vim tips and tricks!
A useful feature that popular editors like VSCode and Atom has is the ability to search and replace...
For further actions, you may consider blocking this person and/or reporting abuse
sed -i -e 's/original/replacement/' fileone.txt filetwo.txt ...
This is a good alternative too! Combined with grep it can do powerful things :)
If only there was some sensible way of replacing a multi-line search string.
Vim's regex can do this with a newline character. So having a buffer like:
This will hit the "one two"
In some cases, depending on the line endings, you might need to include the carriage return:
\r
I almost never get the search string right the first time, so using the highlight search and incremental search settings is really helpful.
All this is super powerful, but I'll leave it to you to determine if it's sensible. :)
Oh yeah that's perfectly sensible and something I knew about, I was more talking about the
sed
approachI tend to use far.vim for that kind of things.
especially as it allows me to check/exclude some of the matches from the refactoring before actually doing it (also, I am notably lazy when it comes to my usage of vim: I love this editor but I also love its plugins :D)
It looks awkward to see multiple files in one buffer at first.
The VS Code community actually requested for this feature lol
Yup!That will work too :)