Solved Anyway to remove vi?

When vim has been installed, there is a need to remove vi.


# pkg delete vi
No packages matched for pattern 'vi'

Checking integrity... done (0 conflicting)
1 packages requested for removal: 0 locked, 1 missing
 
vi is part of the base system, therefore it is not a package that can be removed. *)

You can leave it out when building yourself though, by adding WITHOUT_VI=yes to /etc/src.conf, see src.conf(5).

*) there has been some work in progress called package-base trying to build packages from the base system, so you would get some flexibility without compiling yourself, but it isn't ready for prime yet (and I'm not sure whether it will ever be).
 
I do not advise removing vi even when Vim is installed because vi can be used when Vim cannot be used.
Well, there's still ee(1) in base for such emergencies ;-) But in general, agreed.

I build my base systems without any (screen) editor because I'll exclusively use vim anyways, but then you have to be prepared for situations where you have to fix things using just ed(1), sed(1) and similar. Not to be recommended unless you're experienced enough.
 
If you keep accidentally run vi instead of vim; you can just easily enough alias vi to vim. This way it doesn't affect any system/package file(s), and you can always reset the alias in an emergency too.
 
I do not see any need to remove vi at all.
As I also use vim as my default editor, vi does not disturb anything.
The space it costs is negligibly small.
And some systems situations you better solve with vi, or cannot use vim.
 
Last edited by a moderator:
When vim has been installed, there is a need to remove vi.
I disagree. vi as part of the base is in /usr/bin
vim as a port gets installed in /usr/local/bin. When it installs it may do something like "ln -sf /usr/local/bin/vim /usr/local/bin/vi" to create a symlink, so when someone type in "vi" they get "vim".
Personally, I think this is one of the most annoying behaviors a package can have. if I say vi I want vi not vim/gvim/ngvim or whatever.

If you install and want to use vim, type in vim instead of vi. Or create an alias as others have suggested or put /usr/local/bin ahead of /usr/bin in your PATH
 
vim as a port gets installed in /usr/local/bin. When it installs it may do something like "ln -sf /usr/local/bin/vim /usr/local/bin/vi" to create a symlink, so when someone type in "vi" they get "vim".
Personally, I think this is one of the most annoying behaviors a package can have. if I say vi I want vi not vim/gvim/ngvim or whatever.
We should emphasize the FreeBSD package doesn't do that, as it would be against all packaging policies in FreeBSD.
 
  • Like
Reactions: mer
We should emphasize the FreeBSD package doesn't do that, as it would be against all packaging policies in FreeBSD.
I don't have a ports tree locally so didn't do the work of actually checking if the port did something like that.
But based on the statement in the OP, the OP believes that installing vim does or should create a symlink to vi. A lot/almost all Linux distributions I've seen do this so that may be where the expectation comes from.
Side note, that's another annoyance from Linux distributions: the shell scripts in /etc wind up setting up all kinds of aliases for ls, rm, cp that break sensible usage. I want ls to be "ls" to be /bin/ls or the shell builtin ls, not aliased to some ls put all these wicked colors on everything. rm, /bin/rm not aliased to rm -i. If I want them, I will alias them in my user init files. vi being vim is much of the same.
 
But based on the statement in the OP, the OP believes that installing vim does or should create a symlink to vi.
I didn't understand it that way, all he said was "there's a need to remove vi", without explicit reason given. So, probably just to save the disk space. Which, well, isn't really a need, the base vi is tiny indeed.
A lot/almost all Linux distributions I've seen do this so that may be where the expectation comes from.
Yes, and I agree with you that this is a damn stupid thing to do. If you want an alias, configure it in your shell's config.
 
I didn't understand it that way, all he said was "there's a need to remove vi", without explicit reason given. So, probably just to save the disk space. Which, well, isn't really a need, the base vi is tiny indeed.
Perhaps I read too much into it based on my experience, but if you're typing "vim" then "vi" should never affect you. Agreed that base vi is small and even if dynamically linked, it's not against much.
/rescue/vi is statically linked and is still only 13M so yep, still tiny.
 
Frankly, the world is changing. At $JOB I work with a bunch of sysadmins for Red Hat Linux and for vendor supplied appliances. The older crowd, i.e. myself and a few other old timers use the vi (vim) supplied by the various vendors. However the new sysadmins in our team like to use nano(1). They don't use vi nor do they have the desire to learn it.

A good many of my customers also use nano. vi is arcane to them. As a matter of fact some of them samba share their files to their Windows PCs in order to edit them in notepad and wordpad. It's a different paradigm than someone who's been working with UNIX for a number of decades.

(However as an old UNIX guy explained to me when I was still an MVS (IBM) systems programmer, vi is designed to minimize the movement of fingers from the home keys on the keyboard. It's very efficient. I learned he was correct. But I digress.)

If we can take a lesson away from this, the base FreeBSD must always include ee(1) but we should assume that users may pkg remove vi or at some point may want systems delivered without vi, vim or anything else they may feel uncomfortable with. Editors such as ee and nano are the norm these days.
 
Put EDITOR=vim into your profile.
That is a good solution for things that use the EDITOR variable (less, more other utilities) but doesn't solve the "I typed vi blah.txt and it started vi instead of vim"

I think I and others in this thread are making assumings from the OP.

jronald Why do you think there is a need to remove vi after installing vim?
 
cy@ I don't think you can compare the typical FreeBSD user to a Linux user ... yet. You could discuss whether we really need two different screen editors in base of course. And if you conclude that one is enough, I agree it would have to be ee(1). But I'm pretty sure there are a lot of "vi-users" around here. And as the base vi really isn't large either, no need to do anything, IMO ;)
 
Gentoo tried real hard to get me used to using Nano. It failed. There's just too much muscle memory. I find I litter ":q"s all over the place when I'm using something else (except EMACS, where I also know the basics.) It wouldn't be a big bother for me to install vi or vim as the system editor if Freebsd decided to go that way. I recognize I'm a dinosaur.
 
It would be nice for base to include editors/mg, its twice smaller than vi and a great thing for *macs users. vi always leaves me frustrated when i need to set up new systems.
 
That is a good solution for things that use the EDITOR variable (less, more other utilities) but doesn't solve the "I typed vi blah.txt and it started vi instead of vim"

I think I and others in this thread are making assumings from the OP.

jronald Why do you think there is a need to remove vi after installing vim?
Well... putting an alias in /etc/profile, /etc/csh.cshrc and so on will do the job system wide.
 
IMO vi and emacs would be a barrier to entry for people who just want to get stuff done instead without first studying the archaic machinations of a really awkward text editor that they’re expected to use. I don’t really like Microsoft’s Notepad for example but I appreciate the fact that I can use it without enrolling on a Notepad Course :D .
 
Back
Top