Sometimes I use substitute with confirmation because I only want to replace some instances of a search, depending on the context. However, it's difficult to tell sometimes because as Vim is cycling through the search, the search term will be at the very bottom of my terminal. So, I can't see anything after the thing I searched for - I can't see the relevant context. Do I want to replace this one or not? I can't tell, because I can't see any subsequent lines.
How can I make the substitute with confirmation command show more context?
:help :s_c
gives<C-e>
and<C-y>
'scrolloff'
to something larger than 0 would also help here, by always showing at least that many lines of context after/before the line of the substitution. Of course, that option doesn't affect as/.../.../c
command only, it will always prevent the line of the cursor from being the last one in the window... Still, maybe it might be what you're looking for?zz
(orzt
) would help you, too. Both command scroll the window so that the cursor position is in the middle (or at the top resp) of the screen.