[vim] apply same logic to both cases in replace