Is there a way to specify search and replace range using the current line as a reference? I can specify range using explicit line numbers like
:5,15s/foo/bar/g
<
:help :range
gives you all the details; you can do quite sophisticated things, e.g. :'a;/pat1/-1
.
For ranges starting from the current line, a neat trick is to start command-line mode by prefixing the :
with a count: E.g. 5:
turns into :.,.+4
.
Protip: Learn how to look up commands and navigate the built-in :help
; it is comprehensive and offers many tips. You won't learn Vim as fast as other editors, but if you commit to continuous learning, it'll prove a very powerful and efficient editor.