News for hackers. Stuff that matters.
Re:OpenVi: Portable OpenBSD vi for Unix systems by ruhrharry on Saturday February 19, 2022 @03:51AM (#30395503)
Last time I checked OpenBSD's vi didn't support utf8 - this is a show stopper in 2022.
Re:OpenVi: Portable OpenBSD vi for Unix systems by petepete on Saturday February 19, 2022 @04:03AM (#30395564)
Vis looks like a very minimal but thoroughly modern alternative.

https://github.com/martanne/vis

Re:OpenVi: Portable OpenBSD vi for Unix systems by john-aj on Saturday February 19, 2022 @05:22AM (#30395962)
Indeed. Nvi, which was recommended elsewhere in the thread, supports UTF-8 and is my preferred vi clone. (Actually, OpenBSD vi is an old version of nvi without UTF-8 support.)
Re:OpenVi: Portable OpenBSD vi for Unix systems by trn on Saturday February 19, 2022 @05:09PM (#30400991)
I plan to eventually support multibyte in a way I can contribute upstream to OpenBSD.

The 1.8 branch of the Nvi editor, as well as the Nvi2 fork have mulitbyte support.

I could be mistaken but I believe both of these multibyte implementations descend from the late itojun's (http://www.itojun.org/itojun.html) Nvi-m17n project (archived at https://cgit.freebsd.org/ports/tree/editors/nvi-m17n/files). A paper was presented at USENIX99 (http://www.usenix.org/events/usenix99/full_papers/hagino/hag...) describing the work, which was actually developed as part of the KAME project.

Re:OpenVi: Portable OpenBSD vi for Unix systems by throwawayboise on Saturday February 19, 2022 @01:40PM (#30399347)
It isn't for everyone. I have never come across a real need for more than standard ASCII in any of my work. It absolutely isn't needed for managing unix config files, which is the primary use case for "lightweight" editors like this.
Re:OpenVi: Portable OpenBSD vi for Unix systems by selfhoster11 on Saturday February 19, 2022 @03:30PM (#30400237)
Congratulations on English being the one and only language you use to make quick notes, then. I personally mix in words from my native language wherever I need an extra bit of semantic precision, and I'd rather not have to switch between editors to do so.
Re:OpenVi: Portable OpenBSD vi for Unix systems by throwawayboise on Sunday February 20, 2022 @11:47PM (#30412076)
> Congratulations on English being the one and only language you use to make quick notes, then

It is. If it weren't, I would not use this editor.

Re:OpenVi: Portable OpenBSD vi for Unix systems by kQq9oHeAz6wLLS on Saturday February 19, 2022 @10:52PM (#30403065)
Not to sound dismissive, but that is a rather niche use case
Re:OpenVi: Portable OpenBSD vi for Unix systems by selfhoster11 on Sunday February 20, 2022 @01:12PM (#30407806)
For multilinguals (which is over half of the world's population), throwing in terms from another language or entirely switching to a different language mid-sentence during a conversation is entirely normal. I can't imagine it being that rare in personal notes.
Re:OpenVi: Portable OpenBSD vi for Unix systems by kQq9oHeAz6wLLS on Sunday February 20, 2022 @04:49PM (#30409560)
Sure, but how many of that number are keeping personal notes in vi?
Re:OpenVi: Portable OpenBSD vi for Unix systems by selfhoster11 on Monday February 21, 2022 @03:53AM (#30413406)
Presumably, any number that prefer a terminal based workflow, or have the Vi key scheme burned into muscle memory. Or those that prefer an ultra-minimalist text editor for writing.

Just a decade ago, it was almost a meme that the Emacs and Vi factions fought over which editor is better. I imagine that those that truly bought into the Vi ecosystem/fandom use it in preference to other available options.

Re:OpenVi: Portable OpenBSD vi for Unix systems by kQq9oHeAz6wLLS on Monday February 21, 2022 @03:59PM (#30420534)
You're speaking to a veteran of said editor wars (vi won, naturally) and I still think the number of folks you describe is small these days. I imagine most have switched to a more GUI-friendly editor.
Re:OpenVi: Portable OpenBSD vi for Unix systems by trn on Monday February 21, 2022 @06:27PM (#30422117)
I dogfood OpenVi and use it for OpenVi development, however, 99% of my normal programming workflow is (terminal-based) NeoVim.

The other 1% is Eclipse or VSCode ... and I have VSCode setup to use the embedding functionality of NeoVim.

Re:OpenVi: Portable OpenBSD vi for Unix systems by trasz on Saturday February 19, 2022 @04:50AM (#30395774)
I wonder if they could merge back utf8 patches from FreeBSD.
Re:OpenVi: Portable OpenBSD vi for Unix systems by trn on Saturday February 19, 2022 @04:09PM (#30400555)
This is something that I plan to tackle eventually, and in such as way the work can be contributed back to OpenBSD.
Re:OpenVi: Portable OpenBSD vi for Unix systems by doingtheiroming on Saturday February 19, 2022 @09:52AM (#30397519)
Is it not a feature given how many security issues come out of parsing? There is virtue in the thing you’ll edit files with as root being as simple as you can make it.
Re:OpenVi: Portable OpenBSD vi for Unix systems by anthk on Saturday February 19, 2022 @06:14AM (#30396222)
You have nvi2 in ports.
Re:OpenVi: Portable OpenBSD vi for Unix systems by ruhrharry on Saturday February 19, 2022 @06:39AM (#30396347)
Yes, and also vim and other vi clones. But what is the point of having a secure and integrated OS if you have to pull software from ports (which are not so thoroughly audited and tested as the main OS)?

One point of using BSD is (so the BSD people say) to have an operating system where everything comes from the same team - kernel and userland, unlike Linux where kernel and userland comes from dozens if not hundreds of different origins. But if you start to use arbitrary ports in BSD your OS is not much better than Linux in that regard

Re:OpenVi: Portable OpenBSD vi for Unix systems by salmo on Saturday February 19, 2022 @08:26AM (#30396987)
Historically, this is why basic vi (of whatever flavor) was so popular. I could hop on any Unix and it was there OOB. I dealt with some mixed set of Solaris, BSD, HP-UX, Irix, Tru64, AIX, and Linux for so long.

For a host I did primary development on, I’d install vim (visual mode and then syntax highlighting was so nice).

But we managed config centrally with idempotent scripts that handled the differences (like no getent on HP-UX). We did have to install ksh88 or a clone everywhere to get a stable consistent shell. GNU was flaky on so many platforms then.

Vi was always there for those WTF scenarios, less as a primary programming editor. And it is so nice on slow connections, where repainting the whole screen for every keystroke sucked.

It really annoyed me when Linuxes dropped the basic vi everywhere in favor of nano. I’d be fine with nano as a default for accessibility, but at least have some vi in my path.

Our standard images include it, but I always forget when I’m testing/debugging locally with Vagrant or a Docker image.

Vi is always a little weird. I don’t think any 2 people use it the same. Everyone has their own go-to set of commands. Pairing with grey beards influenced me so much.

I actually started with emacs in college, but real life with 1,000s of servers forced the change. I don’t have the muscle memory for it anymore and have no desire to go back.

Nowadays my local neovim config is almost VSCode. But I still like VSCode-ish in vi more than vi-ish in VSCode. I tried, but inevitably do something that VSCode’s vim plug-in doesn’t support.

I do use go more and more for complex stuff, but often am forced back to shell due to old kernels still out there which hurts my soul.

Re:OpenVi: Portable OpenBSD vi for Unix systems by umanwizard on Saturday February 19, 2022 @12:50PM (#30398956)
> It really annoyed me when Linuxes dropped the basic vi everywhere in favor of nano. I’d be fine with nano as a default for accessibility, but at least have some vi in my path.

Don’t nearly all distros still have something (usually nvi or vim) in /usr/bin/vi out of the box?

Re:OpenVi: Portable OpenBSD vi for Unix systems by trn on Saturday February 19, 2022 @04:44PM (#30400814)
The behavior of the traditional vi is much different than vim and other clones. Nvi was a actually a re-implementation of the traditional vi for 4BSD (to be clean of AT&T code) and thus was originally intended to be bug-for-bug compatible, but breaking away where the original vi behavior was nonsensical or terrible.

For vim, `set compatible` or `set cp` is close, but still not traditional vi by any means.

A multibyte variant of the traditional vi is maintained at https://github.com/n-t-roff/heirloom-ex-vi/.

Nvi (now on version 1.8x) is also maintained - https://repo.or.cz/nvi.git

Nvi2 is yet another fork of Nvi, https://github.com/lichray/nvi2

Despite the very similar names, all of these editors have a variety of different features, and are structured very differently.

Nvi has a concept of a front-end and a back-end (which uses the BDB database). OpenVi uses the OpenBSD version of Berkeley DB which derives from 1.85. Nvi (1.8x) provides a minimal version of code also derived from that release intended from use with Nvi, and (IIRC) also provides support for using Db3/4/5. Similar situation for Nvi2.

Nvi 1.8 has been structured where a third library layer has been added, which doesn't exist in OpenBSD's vi or OpenVi. There is scripting support (Tcl, Perl, etc.) and GUI code in the other various forks ... all of these support various different options as well.

I should probably make a matrix of these, but you can get an idea by looking at the settable options implemented in each of the variants (as they historically include a comment to document from where the option originated):

OpenVi: https://github.com/johnsonjh/OpenVi/blob/22c2a7022e31d91e09e...

OpenBSD vi: https://github.com/openbsd/src/blob/master/usr.bin/vi/common...

Nvi2: https://github.com/lichray/nvi2/blob/5fcdc13656500a8c5b4c073...

Nvi1: https://repo.or.cz/nvi.git/blob/HEAD:/common/options.c#l52

Re:OpenVi: Portable OpenBSD vi for Unix systems by geokon on Saturday February 19, 2022 @07:17AM (#30396567)
I look forward to config files in right to left Hebrew

Or maybe Arabic so the characters flow into each other

Re:OpenVi: Portable OpenBSD vi for Unix systems by bonzini on Saturday February 19, 2022 @08:44AM (#30397079)
No need to wait, I'm sure many people have written their name in their native RTL script for git's "user.name" configuration key.
Re:OpenVi: Portable OpenBSD vi for Unix systems by trn on Saturday February 19, 2022 @05:13PM (#30401023)
For that level of UTF-8 editing, a non-mulitbyte version of the editor suffices. In fact, you can insert and modify multibyte signatures and names using the map facility, however the glyphs are not rendered on screen but are shown at the byte-level.

Improvements are in order, and should be made, but the mere inability to visually render multibyte characters is not always a showstopper.

Re:OpenVi: Portable OpenBSD vi for Unix systems by geokon on Sunday February 20, 2022 @01:34AM (#30403709)
Do they right-align their command lines and files?

Or once the Arabic exceeds 50% the alignment of the buffer flips? :)

Re:OpenVi: Portable OpenBSD vi for Unix systems by selfhoster11 on Saturday February 19, 2022 @03:27PM (#30400209)
Or it could be just as simple as me jotting down some notes in my native language, which includes such exotic characters as ę and ą. You know, so I don't have to go back to using a code page like back in good old DOS days, that I'm actually too young to have lived through.