below... On Mon, Jul 6, 2020 at 3:36 PM John Cowan wrote: > > On Mon, Jul 6, 2020 at 3:19 PM wrote: > > Huh? I've never seen this, in over 20 years of using vim. To >> insert a newline just use >> >> s/foobar/foo^V^Mbar/ >> >> where ^V^M are Control-V Control-M. >> > > I never thought of that; I've always tried what works in ed, namely: > > s/foobar/foo\ > bar > need a closing / for ed, but ex/vi accepts the naked version. > > and that gives me > > foo^@bar > > I call that a bug. (This is vim 8.1). > In fairness, early vi did this too. nvi (Bostic's rewrite) which came out around 4.3 or 4.4 fixed it. > > It certainly wouldn't occur to me to use ^V^M, anyhow: ^V^J would seem > more reasonable, but ^V is ignored in that context. > I agree, I have tried to us the ^V^J idiom with different success. Since vim has been forced down my throat, I tend to not try it, and as you say, switch editors when I need to add a newline. > > Before vim 7 there was a bug so bad I had to use nvi (and, often enough, > compile it from source): at that time, undo undid everything back to the > last action in vi-mode. If you had never been in vi-mode (as I usually had > not) it undid everything back to the last file-loading command! That one > made me grind my teeth a lot. Even now I habitually write before undoing, > just in case. > Amen ... vim's undo can be ... a ... challenging for original vi user - but that has been debated here a few times and I'd rather not see another war. Clem