Hot answers tagged

26

From nvi(1): HISTORY The ex editor first appeared in 1BSD. The nex/nvi replacements for the ex/vi editor first appeared in 4.4BSD. Some background, from memory, so I hope got the details correct: In the beginning, UNIX was free. Everyone could request a copy from Ken, and he would send you a tape with the source (allegedly with the text "love, ...


18

From nvi(1): u Undo the last change made to the file. If repeated, the u command alternates between these two states. The . command, when used immediately after u, causes the change log to be rolled forward or backward, depending on the action of the u command. So press u, and then keep pressing . for more undo; If you ...


4

This seems to be an old but known problem on OS X. This issue has a patch, which is unfortunately not yet incorporated. You can apply it manually to fix your nvi build.


2

The roots of the family trees of vi clones seem to be: 1977: "Traditional vi", Bill Joy's original source, ported and free to use since 2002. 1985: microEmacs, from which the vi-alike "vile" was developed 1987: stevie, from which vim and xvi were developed 1990: elvis, from which nvi was developed 2000: busybox's "tiny vi"


2

Once the cursor is on the @ you can press s to "substitute" the current character. This will delete the current character and leave you in insert mode. Basically, you could replace all your xi and xa with s: map! [ [?]@^[F?s map! { {?}@^[F?s map! ^V^I ^[f@s


2

It seems that nvi uses a special "index file" in /var/tmp/vi.recover/, named recover.XXXXX (where XXXXX is randomly generated). On my system the contents look like: X-vi-recover-file: /home/martin/recover X-vi-recover-path: /var/tmp/vi.recover/vi.AI8Iqs Reply-To: root From: root (Nvi recovery program) To: martin Subject: Nvi saved the file recover ...


2

I finally found a solution: I put this in ~/.nexrc: ab mydate ^[:r !date "+\%a \%d/\%m/\%Y"^MkJA Where: ^[ = CTRL+v+ESC and ^M = CTRL+v+ENTER Many thanks to Antony_ on Freenode channel ##vi for the solution.


1

POSIX has this to say on the matter (emphasis added by me): https://pubs.opengroup.org/onlinepubs/9699919799/ Return to Previous (Context or Section) The [[, ]], (, ), {, and } commands are all affected by "section boundaries", but in some historical implementations not all of the commands recognize the same section boundaries. This is a bug, not ...


1

You can create a mapping for it nnoremap keys :read !date...<CR> Or you can use <C-o>: iabbrev keys <C-o>:read !date...<CR> For historical (vi) compatibility, I believe one can do map! and abbrev—these are listed in Vim under :help vi-features as supported vi features (though I cannot find them in the POSIX spec, they are ...


1

The closest thing the original vi has to multiple undo (aside from U which can revert multiple changes within a single line) is the numbered registers, which hold the nine most recent changes or deletions. If you put from a numbered register, subsequent dot commands will increment that register when it repeats the command. E.g. with the following text, ...


Only top voted, non community-wiki answers of a minimum length are eligible