Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nvi: pick up from where I left off

48 views
Skip to first unread message

Ottavio Caruso

unread,
Oct 8, 2020, 4:52:11 PM10/8/20
to
Hi,

vim automagically remembers where I left off from my last session.

Is there any way to replicate the same behaviour in nvi?

:ver

Version nvi-1.81.6nb5 (2009-08-11)

Thanks.

--
Ottavio Caruso

Eli the Bearded

unread,
Oct 8, 2020, 6:33:40 PM10/8/20
to
In comp.editors, Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> vim automagically remembers where I left off from my last session.

vim uses $HOME/.viminfo for that state to be stored.

> Is there any way to replicate the same behaviour in nvi?

nvi includes no way to store state. Use vim, or rewrite nvi.

(nvi aims to be very close to traditional vi, not an "improvement" like
vim. So nvi has essentially no new features over the vi of yore. I can
only think of support for Gnu "gtags" style tags files as a new feature.
(Some features are renamed, like '-c "cmd"' for '+"cmd"' but are not
really "new".)

Elijah
------
vim, if compiled 'tiny' enough, might not do those "automagic" things

Lewis

unread,
Oct 9, 2020, 4:04:28 AM10/9/20
to
In message <rlnu5p$20f$1...@dont-email.me> Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> Hi,

> vim automagically remembers where I left off from my last session.

> Is there any way to replicate the same behaviour in nvi?

Nope. vim is vi + many new features and improvements and quality of life
features.

nvi is vi from the 70s with no changes at all other than compatibility
with current versions of linux/unix.

If you want a better vi, vim is the package to use.


--
"Are you pondering what I'm pondering?"
[Upon looking for safe passage through colonial India...]
 Pinky:
Well, I think so, Brain, but... no, it's too stupid. Brain: We
shall disguise ourselves as a cow!
 Pinky: Narf, Brain! That was
it exactly!

Geoff Clare

unread,
Oct 9, 2020, 9:11:05 AM10/9/20
to
Lewis wrote:

> nvi is vi from the 70s with no changes at all other than compatibility
> with current versions of linux/unix.

Incorrect. See my reply to Eli the Bearded for details.

--
Geoff Clare <net...@gclare.org.uk>

Geoff Clare

unread,
Oct 9, 2020, 9:11:05 AM10/9/20
to
Eli the Bearded wrote:

> (nvi aims to be very close to traditional vi, not an "improvement" like
> vim. So nvi has essentially no new features over the vi of yore.

You posted similar misinformation here in Nov 2019 and I corrected you
on it then. Please don't make the same false assertion again in future.

New features in nvi that weren't in traditional vi include:

- unlimited undo
- multi-file editing (split screen / backgrounding)
- ex (":") command line editing and history
- filename completion on ex ":" command lines
- "display" command for displaying buffer contents, background screens
and tags stack
- ":set extended" to use EREs instead of BREs
- ":set leftright" to do left-right screen scrolling instead of wrapping
- unnamed delete/yank buffer is preserved across :e
- cscope integration

> (Some features are renamed, like '-c "cmd"' for '+"cmd"' but are not
> really "new".)

That's required by the POSIX standard. All modern versions of "real" vi
do the same.

--
Geoff Clare <net...@gclare.org.uk>

Kenny McCormack

unread,
Oct 9, 2020, 10:19:50 AM10/9/20
to
In article <kg265h-...@ID-313840.user.individual.net>,
Geoff Clare <net...@gclare.org.uk> wrote:
>Lewis wrote:
>
>> nvi is vi from the 70s with no changes at all other than compatibility
>> with current versions of linux/unix.
>
>Incorrect. See my reply to Eli the Bearded for details.

The real question is: Why does or should anyone care?

Just use VIM. Problem Solved. Done.

--
When I was growing up we called them "retards", but that's not PC anymore.
Now, we just call them "Trump Voters".

The question is, of course, how much longer it will be until that term is also un-PC.

Ottavio Caruso

unread,
Oct 9, 2020, 12:53:32 PM10/9/20
to
On 09/10/2020 15:19, Kenny McCormack wrote:
> In article <kg265h-...@ID-313840.user.individual.net>,
> Geoff Clare <net...@gclare.org.uk> wrote:
>> Lewis wrote:
>>
>>> nvi is vi from the 70s with no changes at all other than compatibility
>>> with current versions of linux/unix.
>>
>> Incorrect. See my reply to Eli the Bearded for details.
>
> The real question is: Why does or should anyone care?


If you're stuck on a *BSD system in single mode and you have no network
access and the only editor you have is nvi, who're you gonna call?

>
> Just use VIM. Problem Solved. Done.

Not at all.


--
Ottavio Caruso

Eli the Bearded

unread,
Oct 9, 2020, 3:47:06 PM10/9/20
to
In comp.editors, Geoff Clare <net...@gclare.org.uk> wrote:
> Eli the Bearded wrote:
>> (nvi aims to be very close to traditional vi, not an "improvement" like
>> vim. So nvi has essentially no new features over the vi of yore.
> You posted similar misinformation here in Nov 2019 and I corrected you
> on it then. Please don't make the same false assertion again in future.

My hyperbole is perhaps excessive. Your list of improvements in nvi
compared to vi is essentially nothing compared to vim versus vi, and vim
does at least as good a job at vi compatibility.

Vim documentation of changes between releases:
$ wc -l vim/vim81/doc/version*
355 vim/vim81/doc/version4.txt
7813 vim/vim81/doc/version5.txt
14530 vim/vim81/doc/version6.txt
18312 vim/vim81/doc/version7.txt
34324 vim/vim81/doc/version8.txt
75334 total
$

nvi is standing still.

> New features in nvi that weren't in traditional vi include:
>
> - unlimited undo
> - multi-file editing (split screen / backgrounding)
> - ex (":") command line editing and history
> - filename completion on ex ":" command lines
> - "display" command for displaying buffer contents, background screens
> and tags stack
> - ":set extended" to use EREs instead of BREs
> - ":set leftright" to do left-right screen scrolling instead of wrapping
> - unnamed delete/yank buffer is preserved across :e
> - cscope integration

None of these things help with $OP's desire to have edit position
remembered, do they? You would have pointed that out, correct?

Elijah
------
unnamed delete/yank buffer preservation is best called a "bugfix"

Eli the Bearded

unread,
Oct 9, 2020, 4:06:13 PM10/9/20
to
In comp.editors, Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> If you're stuck on a *BSD system in single mode and you have no network
> access and the only editor you have is nvi, who're you gonna call?

I'll use the vi that exists, of course. Or ed. I'm comfortable in ed.
But that's a case where I expect to have minimal extra features. All day
long I work on remote servers. Maybe I'm old-school, but I just find
things like `vi /var/log/syslog` so much easier to deal with than
hunting logs in Kabana. When I'm doing that, I don't expect anything
more than bare vi, and vim gets in my way. With no $HOME/.exrc or
$HOME/.vimrc, vim starts up with (IMHO) very bad defaults. Usually
":set scrolloff=0 noincsearch" is enough to keep me sane, but sometimes
the colors are annoying, too.

>> Just use VIM. Problem Solved. Done.
> Not at all.

It solves the problem of the original post.

Elijah
------
in some versions of vim scrolloff set to non-zero breaks things like "yL"

Andreas Kohlbach

unread,
Oct 10, 2020, 12:03:54 AM10/10/20
to
On Fri, 9 Oct 2020 14:19:47 -0000 (UTC), Kenny McCormack wrote:
>
> In article <kg265h-...@ID-313840.user.individual.net>,
> Geoff Clare <net...@gclare.org.uk> wrote:
>>Lewis wrote:
>>
>>> nvi is vi from the 70s with no changes at all other than compatibility
>>> with current versions of linux/unix.
>>
>>Incorrect. See my reply to Eli the Bearded for details.
>
> The real question is: Why does or should anyone care?

May be someone like pain. Well I do once in awhile. Just for fun I fired
up CP/M on an (emulated) Osborne I and struggled to write some text with ED.

> Just use VIM. Problem Solved. Done.

Indeed.
--
Andreas

PGP fingerprint 952B0A9F12C2FD6C9F7E68DAA9C2EA89D1A370E0

Lewis

unread,
Oct 10, 2020, 5:04:10 AM10/10/20
to
In message <rlq4i9$3j2$1...@dont-email.me> Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> On 09/10/2020 15:19, Kenny McCormack wrote:
>> In article <kg265h-...@ID-313840.user.individual.net>,
>> Geoff Clare <net...@gclare.org.uk> wrote:
>>> Lewis wrote:
>>>
>>>> nvi is vi from the 70s with no changes at all other than compatibility
>>>> with current versions of linux/unix.
>>>
>>> Incorrect. See my reply to Eli the Bearded for details.
>>
>> The real question is: Why does or should anyone care?


> If you're stuck on a *BSD system in single mode and you have no network
> access and the only editor you have is nvi, who're you gonna call?

Yeah, that's a super common scenario in 2020.

>> Just use VIM. Problem Solved. Done.

> Not at all.

Oh yes, vim solves the problem.


--
Love is strange and you have to learn to take the crunchy with the
smooth I suppose

Geoff Clare

unread,
Oct 12, 2020, 8:41:04 AM10/12/20
to
If the question hadn't already been answered, yes I would.

As it happens, I dislike that feature of vim. I use vim so seldom
that, when I do, I'm often caught out by this feature. (I briefly
think "how did the first part of the file get deleted" before
realising that vim has positioned me where I was last time I
edited the file, which could have been several years previously.)

--
Geoff Clare <net...@gclare.org.uk>

Kenny McCormack

unread,
Oct 12, 2020, 9:13:32 AM10/12/20
to
In article <qdud5h-...@ID-313840.user.individual.net>,
Geoff Clare <net...@gclare.org.uk> wrote:
...
>As it happens, I dislike that feature of vim. I use vim so seldom
>that, when I do, I'm often caught out by this feature. (I briefly
>think "how did the first part of the file get deleted" before
>realising that vim has positioned me where I was last time I
>edited the file, which could have been several years previously.)

Totally agree.

One of the standard things in all of my .vimrc files is to turn the
viminfo thing off:

set viminfo=

I don't need it and I don't like it.

--

Prayer has no place in the public schools, just like facts
have no place in organized religion.
-- Superintendent Chalmers

Lewis

unread,
Oct 12, 2020, 1:17:19 PM10/12/20
to
In message <rm1kpp$1d465$1...@news.xmission.com> Kenny McCormack <gaz...@shell.xmission.com> wrote:
> In article <qdud5h-...@ID-313840.user.individual.net>,
> Geoff Clare <net...@gclare.org.uk> wrote:
> ...
>>As it happens, I dislike that feature of vim. I use vim so seldom
>>that, when I do, I'm often caught out by this feature. (I briefly
>>think "how did the first part of the file get deleted" before
>>realising that vim has positioned me where I was last time I
>>edited the file, which could have been several years previously.)

> Totally agree.

> One of the standard things in all of my .vimrc files is to turn the
> viminfo thing off:

> set viminfo=

> I don't need it and I don't like it.

Nice to have the option one way or the other, which you do not have
with nvi or vi. There are many many things you can do in vim if you want
that are not possible in nvi. You can even make vim behaved basically as
bone-headed 1970s as vi/nvi if you want.

--
Hudd: 'I've just done this radio show where I never met any of the
other actors and I didn't understand what any of it was about'
Moore: 'Ah, yes I expect that's the thing I'm in.'

Ottavio Caruso

unread,
Oct 13, 2020, 10:22:18 AM10/13/20
to
My OP at the end of this post.

Somebody on IRC/Freenode suggested this:

1) map a key to write a non-printing character where the cursor is +
save + quit

2) map another key to search for that non-printing character and move to
that line.


Any opinion on this strategy and how to implement it?

Thanks

Eli the Bearded

unread,
Oct 13, 2020, 5:37:34 PM10/13/20
to
In comp.editors, Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> My OP at the end of this post.
>
> Somebody on IRC/Freenode suggested this:
>
> 1) map a key to write a non-printing character where the cursor is +
> save + quit
>
> 2) map another key to search for that non-printing character and move to
> that line.
>
>
> Any opinion on this strategy and how to implement it?

That's perfectly fine for a text file only used by you. You, as a human,
can encounter this marker in a file and not be thrown off by it. Your
code also needs to consider removing / moving that marker when needed.

That's a terrible idea for source code or system config files. A
computer, encountering unexected and syntax violating character in
something it is trying to "understand" will likely throw errors.

If you want to create a set of manual bookmarks that go to specific
places in specific files, that's what tags do. In traditional vi, so
probably in nvi, the standard tag syntax is:

tagname (tab) filename (tab) motion

Where the motion is generally in the form of a /search string/ or
a line number. Traditional vi allows *any* ex mode command for the
motion, there can be a security risk in that, so vim (and possibly
nvi) has tightened the rules.

So I'd look for a way to create/update tags for storing file locations
if it were me doing this. (I have used tags for storing bookmarks
before, but not used tags created on the fly.)

Elijah
------
or use vim and have viminfo take care of it

Matias Ikkala

unread,
Jun 10, 2021, 2:15:44 AM6/10/21
to
perjantai 9. lokakuuta 2020 klo 17.19.50 UTC+3 Kenny McCormack kirjoitti:
> In article <kg265h-...@ID-313840.user.individual.net>,
> Geoff Clare <net...@gclare.org.uk> wrote:
> >Lewis wrote:
> The real question is: Why does or should anyone care?
>
> Just use VIM. Problem Solved. Done.

I'm so tired of people always saying that when someone is specifically asking about nvi, xvi, traditional vi etc. Just answer the damn question and leave it that.

For example I am using Vim but like to study the older versions too, and it does not help at all when people say things like that, which are completely unrelated to the question.

Lewis

unread,
Jun 10, 2021, 1:31:12 PM6/10/21
to
In message <c82c7c5e-4e71-4667...@googlegroups.com> Matias Ikkala <matias...@gmail.com> wrote:
> perjantai 9. lokakuuta 2020 klo 17.19.50 UTC+3 Kenny McCormack kirjoitti:
>> In article <kg265h-...@ID-313840.user.individual.net>,
>> Geoff Clare <net...@gclare.org.uk> wrote:
>> >Lewis wrote:
>> The real question is: Why does or should anyone care?
>>
>> Just use VIM. Problem Solved. Done.

> I'm so tired of people always saying that when someone is specifically
> asking about nvi, xvi, traditional vi etc. Just answer the damn
> question and leave it that.

People asking for nifty feature in nci that did not and do not exst in
vi do not understand what nvi *is*. The correct answer to any question
that is "hwo do I do this thing thatt vi can't do" is "don't use vi, and
that included nvi."

> For example I am using Vim but like to study the older versions too,
> and it does not help at all when people say things like that, which
> are completely unrelated to the question.

You are asking how to use ABS on a Ford Pinto. The Ford Pinto did not
have ABS, so the answer is "Don't user a Ford Pinto."

--
I want to secede, but I don't know what state I'm in. - Bart Simpson, 2012

sehnsucht

unread,
Feb 5, 2022, 11:44:25 AM2/5/22
to
Sul meriggio di 131020 14:22,
Ottavio Caruso <ottavio2006...@yahoo.com> enarrava tali parole:
> My OP at the end of this post.
>
> Somebody on IRC/Freenode suggested this:
>
> 1) map a key to write a non-printing character where the cursor is +
> save + quit
>
> 2) map another key to search for that non-printing character and move to
> that line.
>
>
> Any opinion on this strategy and how to implement it?
>
> Thanks
>
You could for example explicitly set a non iso-8559 character like '§'
as non printable, by adding:

set noprint=§

to your ~/.exrc.

You can add it at the beginning of the current line by pressing 'I' in
command mode.
Then you can start vi with the cursor placed at the section sign, by
typing:

$ vi +/§ $filename

You may also alias 'vi +/§' to vi in your ~/.profile.

A cleaner and better strategy would be, imho, to just remember the line
you left at (e.g. especially if you edited the file immediately before).

:set nu #display line nummbers

Then, upon re-editing, you can type a colon followed by the line number
to go back where you left.
--
sehnsucht ~ http://sehnsucht.multics.org
gopher://tilde.pink:70/1/~snowcrash/
0 new messages