Ask Your Question

Why are vi and vim are two different files?

asked 2018-01-12 13:41:11 -0500

Alex D gravatar image

Yet both vi and vim --version says it's Vi iMproved.

When I set up my ~/.vimrc, it only gets picked up by vim, not vi. If I rename .vimrc to .virc then vi complains about unknown option 'set numbers', which means it's not really Vi iMproved.

Coming from Debian and Mint, I'm used to vi being a symlink to vim. Does anyone have an explanation why it's different in Fedora vs Mint/Debian?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-01-12 20:53:05 -0500

By default, Fedora 27 ships with the "vim-minimal" package. This includes a binary which is placed on the system as '/usr/bin/vi'. This is not the original vi executable, of course, but it is a stripped-down version of the executable which, in its more robust form, is installed into Fedora through the "vim-enhanced" package as '/usr/bin/vim'.

Because it is assumed that people who install vim-enhanced would actually like to make use of the enhanced binary rather than the minimal binary, a shell alias is provided by the vim-enhanced package (as created by the file '/etc/profile.d/').

So that's why you have an alias for vi to vim (and therefore why you end up inside vim even when you attempt to specify "vi"), but also why you have two separate binaries and not a simple symlink from vi to vim. If you'd like to use vi and not vim (and you intend to distinguish between them frequently), you can remove the alias (perhaps with a .bashrc command of your own rather than modifying or removing the /etc/profile.d/ script, as that will be recreated with a vim-enhanced update), or you can simply use the fully-qualified name to call vi ('/usr/bin/vi'), or you could make a separate alias for vi, etc.

edit flag offensive delete link more


And then there is vimx which is vim with mouse support, and gvim which is graphics version of vim.

villykruse gravatar imagevillykruse ( 2018-01-13 10:41:53 -0500 )edit

answered 2018-01-12 14:57:23 -0500

toddandmargo gravatar image

Hi Alex,

You are probably aliased. Check it out with the following:

$ ls -al /usr/bin/vi
-rwxr-xr-x. 1 root root 1106696 Jan  2 04:21 /usr/bin/vi

$ ls -al /usr/bin/vim
-rwxr-xr-x. 1 root root 2990064 Jan  2 04:21 /usr/bin/vim

$ which vi
alias vi='stty erase ;/usr/bin/vim'

$ alias | grep vi
alias vi='stty erase ;/usr/bin/vim'


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-01-12 13:41:11 -0500

Seen: 75 times

Last updated: Jan 12