How to Compile Vim

Compiling on Ubuntu

To build vim from source on Ubuntu:

  1. Get a copy of the source code by downloading from the official Vim repository on GitHub.
  2. Get the dependencies by running $ sudo apt-get build-dep vim-gnome or similar.
  3. Go to the directory of the Vim source code: cd vim/src
  4. Run $ ./configure. You can customize the build (and enable Perl, Python, etc. language integrations) by passing configuration options. See src/INSTALL for an overview.
  5. Run $ make.
  6. Finish the installation by running $ sudo make install. As your self-compiled Vim is not managed by the package manager, it will be placed in /usr/local/bin/vim, instead of /usr/bin/vim. So, to run it, you either need to specify the full path, or ensure that /usr/local/bin is before /usr/bin in your PATH (it usually is).
  7. (Optional) Remove the distribution-provided version of Vim if you had it installed already: $ sudo apt-get remove vim vim-runtime gvim.

To verify the installation, you can run $ which vim which should return something like /usr/local/bin/vim if the installation was successful.