DaemonForums  

Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

View Poll Results: Which vi do you use?
original vi 10 19.23%
nvi 4 7.69%
vile 0 0%
elvis 0 0%
vim 34 65.38%
some other vi clone 0 0%
I don't use vi 4 7.69%
Voters: 52. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old 11th September 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

You're welcome, TerryP.

I've always just used "vi" on FreeBSD, but I wondered about whether "nvi" was installed. /usr/bin has both, but they are the same file size, and diff shows no differences between the files.

Are they the same? If so, why not just use a symbolic link and save a bit of disk space?
Reply With Quote
Old 12th September 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

/usr/src/user.bin/vi/Makefile sets things up to build vi from the desired parts of /usr/src/contrib/nvi, the makefile defines a list of $(LINKS) mapping n(vi/ex/view) to their traditional counter parts, and let's bsd.prog.mk handle creating the hardlinks.

But I don't understand your comment about using a symlink though. Shouldn't a hardlink be more efficient then a symbolic link? A number of things on the system appear to be just hard links, on my OpenBSD 4.3 machine for example, sh, ksh,rksh all have the same inode number and number of links.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 12th September 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

Quote:
Originally Posted by TerryP View Post
But I don't understand your comment about using a symlink though. Shouldn't a hardlink be more efficient then a symbolic link?
That would be fine too. Just a link of some sort instead of repeating the same file. vi/nvi/vniew/view all have identical file sizes (281K). It is only about 750K saved to do the linking, but the BSDs are usually efficient in this regard. (This is a pretty stock install.) I understand that the view files require different start-up flags, but that could be a simple script instead of the whole file.

Yes, this is a small nit. These days I don't really care much about file sizes. It is just contrary to the BSD philosophy.
Reply With Quote
Old 12th September 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default

Quote:
Originally Posted by DrJ View Post
You're welcome, TerryP.

I've always just used "vi" on FreeBSD, but I wondered about whether "nvi" was installed. /usr/bin has both, but they are the same file size, and diff shows no differences between the files.

Are they the same? If so, why not just use a symbolic link and save a bit of disk space?
vi on *BSD should be nvi. vi was a victim of the 1993 agreement (I think), the source being kept by whoever had the copyright (wasn't BSD). So nvi (new vi) was written as a drop in replacement - Nex/nvi are intended as bug-for-bug compatible replacements for the original Fourth Berkeley Software Distribution 94BSD) ex and vi programs. (manpage(vi)). So at least the three main BSD's (if not all) should be using nvi as their vi. (compare Linux which is usually elvis or vim-lite)

It just so happens that the source code for the original vi has been released under a BSD-like license. You can get it here.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
Old 12th September 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default

Quote:
Originally Posted by DrJ View Post
Yes, this is a small nit. These days I don't really care much about file sizes. It is just contrary to the BSD philosophy.
Could you please expand on this?
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
Old 12th September 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

Quote:
Originally Posted by JMJ_coder View Post
Could you please expand on this?
Simply that excess bloat is removed. Multiple files containing the same thing is just not what the BSDs do. Maybe they are indeed the same files; I only did simple file sizes, diffs and directory listings.
Reply With Quote
Old 12th September 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

A quick look, makes me think that they are all hardlinks:

Code:
Terry@dixie$ uname -a                                                      3:03
FreeBSD dixie.launchmodem.com 7.0-STABLE FreeBSD 7.0-STABLE #0: 
Thu Jul 17 15:17:58 UTC 2008
root@sall1600.launchmodem.com:/usr/obj/usr/src/sys/VIPER  i386
Terry@dixie$ stat -Lx /usr/bin/nvi                                         3:26
  File: "/usr/bin/nvi"
  Size: 305964       FileType: Regular File
  Mode: (0555/-r-xr-xr-x)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 0,91   Inode: 6382697    Links: 6
Access: Tue Sep  9 05:44:13 2008
Modify: Thu Jul 17 20:27:57 2008
Change: Thu Jul 17 20:27:58 2008
Terry@dixie$ ls -i1 /usr/bin/n{vi,ex,view} /usr/bin/{vi,ex,view}           3:26
6382697 /usr/bin/ex*
6382697 /usr/bin/nex*
6382697 /usr/bin/nvi*
6382697 /usr/bin/nview*
6382697 /usr/bin/vi*
6382697 /usr/bin/view*
Terry@dixie$                                                               3:27
The source code for nvi also seems to show that it adopts itself based the name of the executable file.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 12th September 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

Well, earlier you learned something, and now I do. Thanks!
Reply With Quote
Old 12th September 2008
bigb89 bigb89 is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 69
Default

I started using vim when I first got to *nix world.

But then I noticed that vim did not come by default on a lot OS's and while vi did. And there were also alot of files that the default editor for them would be vi. So I decided it would be more worth it for me if I learned vi instead of vim.
Reply With Quote
Old 12th September 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

Quote:
Originally Posted by JMJ_coder View Post
At least nvi allows multiple undo. Press 'u' to undo and then '.' to undo as much as you want.
In vim you can do this by using 'u' and 'Ctrl-R' (redo).

IMO, comparing vi/nvi with vim is a futile exercise. nvi is a very nice editor and I know that there is a NIH associated with vim among BSD users, but if you are an experienced vi user, for programming you need vim. period.
Reply With Quote
Old 12th September 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 661
Default

For me, it's simply that vim does the best job of handling Japanese. I don't like syntax highlighting and turn it off. (In several Linux distributions, they highlight by default.)
Reply With Quote
Old 13th September 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default

Quote:
Originally Posted by scottro View Post
For me, it's simply that vim does the best job of handling Japanese. I don't like syntax highlighting and turn it off. (In several Linux distributions, they highlight by default.)
nvi has internationalization support. If it is available it's should be in packages/ports editors/nvi-m17n-1.79.20040401nb4 -or similar.

To enable it you probably need to set the locale. According to nvi website:

Quote:
# How can I get vi to display my character set?

Vi uses the C library routine isprint(3) to determine if a character is printable, or should be displayed as an octal or hexadecimal value on the screen. Generally, if vi is displaying printable characters in octal/hexadecimal forms, your environment is not configured correctly. Try looking at the man pages that allow you to configure your locale. For example, to configure an ISO 8859-1 locale under Solaris using csh, you would do:

setenv LANG C

setenv LC_CTYPE iso_8859_1

Other LC_CTYPE systems/values that I'm told work:

System Value
FreeBSD lt_LN.ISO_8859-1
HP-UX 9.X american.iso88591
HP-UX 10.X en_US.iso88591
SunOS 4.X iso_8859_1
SunOS 5.X iso_8859_1

If there's no other solution, you can use the print and noprint edit options of vi to specify that a specific character is printable or not printable.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
Old 13th September 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default

I spent the better part of a day trying to cross compile nvi to run on windows. That was a futile effort. I couldn't get it to work nice with configure and the makefile.

elvis and vim both have pre-compiled versions, so I put those on a flash drive to use at school editing files.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
Old 13th September 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

You can get nvi for Windows as part of UWin, the Unix-for-Windows package from (the former) Bell Labs. It has many useful tools, including a good ksh implementation. That makes sense, since it is David Korn's project.
Reply With Quote
Old 13th September 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 661
Default

There is an nvi-japanese--however, it simply doesn't seem to work as well with Asian input as does vim.

Then of course, one gets used to vim-isms--they aren't necessarily better or worse, they're simply habits by now.
Reply With Quote
Old 13th September 2008
hydra's Avatar
hydra hydra is offline
Port Guard
 
Join Date: May 2008
Location: Slovakia (Europe)
Posts: 41
Default

vim
Reply With Quote
Old 15th September 2008
Sunnz's Avatar
Sunnz Sunnz is offline
Real Name: I don't have real time
Just a computer user...
 
Join Date: May 2008
Location: See Google Maps
Posts: 101
Default

Quote:
Originally Posted by marcolino View Post
nvi, which is in a default OpenBSD install. Until recently, I used vim, installed from ports.
Hey I can't find nvi in my OpenBSD install... so I guess /usr/bin/vi is really nvi?

And I voted for the original vi!! I voted wrongly then...
__________________
She sells C shells by the seashore.
Reply With Quote
Old 15th September 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

yes it is nvi, I guess they just didn't see any point in any n* hardlinks.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 15th September 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I wonder how many other people wrongly voted for vi when they actually use nvi.... cruel world.
Reply With Quote
Old 15th September 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Well beyond DrJ, I don't know any of the others in the poll thus far to say original Vi. But I would hope most people got it right.


And just for the heck of it, doing :version in /usr/bin/vi (nvi) on FreeBSD 7-STABLE:

Code:
Version 1.79 (10/23/96) The CSRG, University of California, Berkeley.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Tags
nvi, vi, vim


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:24 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick