Installing VIM on Linux
by Nathan Wallace
(Oct 28, 1999)
These instructions describe the installation of Vi IMproved
on Linux. They were written specifically using VIM 5.5 on Red Hat
Installing VIM is the first thing I do on any computer since it increases my productivity dramatically.
- You need to perform this installation as root. You can install VIM locally for your own use, but I like to make it available to all users on the machine.
- I put all my downloads in /usr/local/download. You might need to create that directory now:
- Now we can get VIM from your nearest mirror. You need to get 2 files, vim-5.5-rt.tar.gz and vim-5.5-src.tar.gz. Here are the ftp commands:
- First we must unpack the distribution. Don't be scared by this fairly powerful tar command, it just unzips and extracts the tar into /usr/local (..).
tar xzf vim-5.5-rt.tar.gz -C ..
tar xzf vim-5.5-src.tar.gz -C ..
- Create a link to the vim version for convenience:
ln -s vim5.5 vim
- Now we can compile VIM:
- And install the VIM binaries in your path:
- You can check that the installation worked by typing:
- Remember that VIM can be used in the graphical mode like above or in a console using:
- If you are new to VI and VIM then you should probably work through the tutorial:
Running the New Version
- Just about every unix system has vi installed. On Red Hat, vi is just vim running in compatible mode (ie: lots of features turned off). Depending on how your original system was configured you may still be using an old version of vim, not the freshly installed one. My system has vi installed as:
This is actually version 5.4 of vim (you can tell by executing :version or looking at the startup screen). I changed it to use the new version by doing this:
mv vi vi.old
ln -s /usr/local/bin/vim vi
- You may also like to check that the newly installed programs are the ones being run. If there is an old version before the new one in the system path then it will be executed. You can see the location of an executable on the path with the which command:
On my system this returns the new version:
Setting Up Your VIM Environment
- You can configure your VIM options through an initialization file. For more information about this in VIM type:
- I like to use the following options:
map Y y$
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
These basically just set up tabs to work as 4 spaces, turns on autoindenting, changes Y to yank the rest of the current line and turns on syntax highlighting only when we are in gui mode.
- The options above need to be saved into a file. I want them available to all accounts (since only I use the machine) so I put them in the global location:
- If you want settings specific to a certain user then create a config file in their home directory. For example: