Ask Your Question

Why are vi and vim are two different files?

asked 2018-01-12 19:41:11 +0000

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-13 02:53:05 +0000

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/vim.sh').

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/vim.sh 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 ( 2018-01-13 16:41:53 +0000 )edit

answered 2018-01-12 20:57:23 +0000

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

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.


Asked: 2018-01-12 19:41:11 +0000

Seen: 54 times

Last updated: Jan 13