Ask Your Question
0

Why is the vim alias only set for user id above 200? (vim-enhanced.x86_64 2:7.4.179-1.fc20)

asked 2014-04-05 21:48:32 -0500

Luis Gallo gravatar image

Hi Everyone,

First time on Ask Fedora.

I would like to know if there is a reason why the vim alias in /etc/profile.d/vim.sh (and vim.csh) is set only for users whose id is above 200.

I found this while trying to edit a few files in /etc logged in as root. It is easily solved by removing the if clause in the vim.sh (and vim.csh) scripts. However I'm still curious about the reason for putting that condition there.

Contents of /etc/profile.d/vim.sh

if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then
  [ -x /usr/bin/id ] || return
# (Luis) Removing the if clause to set the alias for every user
#  ID=`/usr/bin/id -u`
#  [ -n "$ID" -a "$ID" -le 200 ] && return
  # for bash and zsh, only if no alias is already set
  alias vi >/dev/null 2>&1 || alias vi=vim
fi

Thank you!

Luis

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-04-06 01:10:51 -0500

Ahmad Samir gravatar image

updated 2014-04-06 01:14:10 -0500

This is an intentional behaviour, the rationale is explained in this bug report.

Edit: since /etc/profile.d/vim.sh is marked as a config file, your changes won't be overwritten when the vim-enhanced package is updated.

edit flag offensive delete link more

Comments

Thank you!.

Seems like a philosophical discussion, can't really say that I'm for or against.

Curiously, though, one of he comments read "using /bin/vi for users with UID < 100 including UID 0 is intentional" yet the vim.sh script does it for UID < 200.

I appreciate your answer. I wouldn't have looked for it in bugzilla.

Best regards.

Luis Gallo gravatar imageLuis Gallo ( 2014-04-06 10:53:15 -0500 )edit

“one of he comments read "using /bin/vi for users with UID < 100 including UID 0 is intentional" yet the vim.sh script does it for UID < 200.”

I think that was the behaviour at the time the bug report was filed but that it was changed at some point to use the UID < 200 condition.

Ahmad Samir gravatar imageAhmad Samir ( 2014-04-06 11:12:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-05 21:48:32 -0500

Seen: 351 times

Last updated: Apr 06 '14