> i['d] forgotten & (not that useful in vim) but yes! now you reminds me, it
makes perfect sense to use it in nvi.

Speaking of things that make no sense in one vi clone but work in
another, I recently ended up looking for a way to count occurrences of
'abc' in FILE, from within vi.
In vim you just do  :%s/abc//gn  (assuming you're editing FILE), but
this won't work in nvi, so I came up with this cumbersome method:

:!cat FILE | tr '\n' ' ' | awk '{print gsub(/abc/, "")}'

If it's stupid but it works, it ain't stupid, right?  Unless someone
else knows a better way?  Apologies if this is a borderline-thread
hijack.

--Ian

PS:
For the opposite case, of vim being annoyingly impaired and nvi simply working:

A close reading of vi(1) taught me there's a simple way to deal with
multiple files in nvi, without which copying and pasting from one file
to another can be unnecessarily cumbersome: In nvi, while editing
FILE1, just
:E FILE2
and use ^W to jump between FILE1 and FILE2 and then just :q the one
you're finished with.

Sadly, :E doesn't actually work in vim.  It says
> E464: Ambiguous use of user-defined command

I don't know what works in vim.  vim prolly has a dozen
chrome-electroplated ways to do the same thing, but I don't know them.

Reply via email to