Linux – CentOS – Enable Syntax Formatting for vi
Had a weird issue last week where I tried to enable PHP formatting for vi, but it wasn’t working and took me a bit to figure out what was going on, so I wanted to blog it in case anyone else was dealing with similar issues.
By default, CentOS 5.x will install vi using vim-minimal.<arch> package, which is just vi, not actual vim. Even though you type `vi` and it says vim, it is not, it is actually vi. You can confirm this by issuing this command: `which vi`, and you will see that it points to /bin/vi.
Now that we’ve identified the problem, let’s fix it so we can enable syntax highlighting. Just follow these few extra steps:
yum install vim-common vim-enhanced
The above command will install ‘vim’. Now we need to point the vi command to it’s vim counterpart, you can do this one of two ways:
1. you can setup an alias in /etc/profile (or ~/.bash_profile)
alias vi="/usr/bin/vim"
2. or you can use a symlink:
ln -s /user/bin/vim /bin/vi
Now when you `vi` it will use vim instead, and your syntax formatting should work as expected.

