Bug 77007 - /etc/profile.d/vim.* breaks compatible functionality
/etc/profile.d/vim.* breaks compatible functionality
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: vim (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
David Lawrence
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-30 16:24 EST by grosen
Modified: 2007-04-18 12:48 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-11-12 10:43:29 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description grosen 2002-10-30 16:24:10 EST
Description of Problem:

Vim, good-naturedly, behaves very much like traditional vi if you call it as "vi" including, but not limited to, not slathering my terminal with colored text. But Every RH 7.x system I just checked (and, I presume, RH 8 as well) installs /etc/profile.d/vim.[c]sh, which does nothing more than alias vi to vim, completely breaking Vim's compatible behavior.

Why?

Is the presumption that a new user will be able to deal just fine with a moded editor as long as they have context coloring? Does that actually make sense to *anyone*?

Please, when I say "vi", give me vi, and when I say "vim", give me Vim.

Version-Release number of selected component (if applicable):

vim-enhanced-6.0-7.13

How Reproducible:

every time

Steps to Reproduce:
1. Install a fresh RH system, choose "Everything" package option.
2. login
3. `which vi`

Actual Results:

$ which vi
alias vi='vim'
        /usr/bin/vim

Expected Results:

$ which vi
/bin/vi

Additional Information:

While I'm at it, vim.sh is COMPLETELY wrong-headed. It says this:

if echo $SHELL |grep bash 2>&1 >/dev/null; then # aliases are bash only
        alias vi=vim
fi

First, not all shells *set* $SHELL, so you lose and do the wrong thing if it's not set. Checking ARGV[0] would be the best choice.

Second, the comment is flat-out wrong (unless it's meant to imply that Red Hat default files only *set* aliases for shells that are bash, though that's also untrue). The only Bourne-derived shell that doesn't have aliases is real sh (and you're shipping an sh that's actually bash anyway). ksh, ash, zsh... all of these use exactly the same format for alias definition.

Granted, I wouldn't want to see this changed and the file left; it's saving me from getting this silly alias set in my regular user accounts, since I use the Z shell there, but it seems mighty remiss to have default system files stating outright false information.
Comment 1 Karsten Hopp 2002-11-12 08:54:48 EST
The current vim.sh looks quite different and checks for BASH_VERSION and
KSH_VERSION. I've added a check for ZSH_VERSION.
Comment 2 grosen 2002-11-12 10:43:17 EST
I don't see how this resolution specifically addresses the real problem:

You're removing functionality from Vim by forcing vi to be an alias for vim.

Is that behavior gone in Rawhide?

(I'd check for myself, but I can't seem to find Rawhide tagged sources anywhere
in sources.redhat.com. Sorry, I'm used to NetBSD, where cvsweb gets me an easy
answer for "what's current". Are RH sources even available.)

As near as I can tell, this "feature" is the result of a commit on 02 Jun 2001
by bero@redhat.com, because "too many people complained about missing features
in vi even though I installed vim-enhanced".

I understand why you caved, but you're wrong to. Vim installs itself a certain
way because people who know what they're doing expect to get vi when they say
vi and expect to get Vim when they say vim. Why is Red Hat catering to the
lowest common denominator on this? The documentation of this behavior is plenty
clear in Vim's man page.
Comment 3 Karsten Hopp 2002-11-12 11:03:25 EST
You're wrong here. By setting the vi alias to vim, you get all the functionality
of vim, you don't loose it. 
You're right that Bero added this behaviour because too many people complained 
and I agree with his decision. Most people really want vim with all its features,
/bin/vi was intended for sysadmin tasks where /usr wasn't mounted and such things.

If you want the plain, minimal /bin/vi, please feel free to 
- remove /etc/profile.d/vim*   or
- remove the vim-enhanced package or
- start /bin/vi instead of 'vi'

Comment 4 grosen 2002-11-12 11:20:19 EST
Right then.

Guess I'll be switching all my production systems to Debian.

Thanks for your time!

Note You need to log in before you can comment on or make changes to this bug.