Vim Tips Wiki
Advertisement
Tip 376 Printable Monobook Previous Next

created 2002 · complexity basic · version 7.0


This tip presents an overview of how to download the source for Vim, then build a Vim executable, and install it on your system. You need to download the C source code and the runtime files (standard plugins, help files, and more). You may also need to download dependencies (packages required for building), and you will need a compiler/linker (free versions are available for almost all systems).

Any platform

It is very easy to build Vim from the source code. We even have some tips for building Vim. In general, it takes four steps:

  1. Get dependencies. On Unix-like systems, apt-get build-dep vim-gnome or similar can do this for you. On Windows, there are no dependencies, unless you want to build Vim to use an external DLL for Lua, Perl, Python, Ruby, or Scheme (and you can install these later).
    Note: apt-get is for Debian, Ubuntu and similar distributions. On other distributions, the corresponding program may be called yum, yast, zypper, or otherwise, and the way to invoke it may vary widely. It is usually the same program as the one used on your distro to install, update, or uninstall any software package, and if you are lucky, there may be a manpage for it.
  2. Get the Vim source code from Mercurial.
  3. Change to the directory with the Vim source code and run "make".
  4. Do a "make install" or manually copy necessary files to somewhere Vim knows to use. See :help $VIMRUNTIME for details and our tip on manually locating your Vim files.

Overview

The following applies to Unix-based systems, and Windows.

Download the source from ftp://ftp.vim.org/pub/vim/unix/

  • vim-7.2.tar.bz2 (7.1MB)

Download the extras from ftp://ftp.vim.org/pub/vim/extra/

  • vim-7.2-extra.tar.gz (0.8MB)
  • vim-7.2-lang.tar.gz (1.4MB)

Expand each in the same directory, for example somewhere/vim/build/72/

Download the patches from ftp://ftp.vim.org/pub/vim/patches/7.2/

Apply the patches.

Configure.

Build (compile and link).

Install.

Building GUI Vim on Ubuntu

You need the required development packages on Ubuntu to build the GUI:

sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
  libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
  libcairo2-dev libx11-dev libxpm-dev libxt-dev

Commands to build and install GUI Vim:

$ cd vim7
$ cd src
$ make distclean
$ ./configure --with-features=huge --enable-gui=gnome2
$ make
$ sudo make install

Miscellaneous

In Vim, the command :version includes "Compiled by user@host" (the user and computer host names are provided by the operating system).

The configuration option --with-compiledby can be used to set the exact "Compiled by" text (for example, to include an email address).

Comments

See also:

--Tonymec 11:51, June 18, 2010 (UTC)


The Main Page links to Vim documentation and I would eventually like that page cleaned up with a new section about downloading and building Vim (no details, just links to relevant tips).

The following seem relevant (may need to merge):

JohnBeckett 04:34, May 22, 2008


I think you're saying the same thing, but I certainly recommend leaving the "building" tips separate from this one. I've tried to add info at the top of this tip to indicate how easy it is, but I know most people just want a "grab and go" download they can use. Maybe we should move that section? It probably needs a little work, still. --Fritzophrenic 20:23, July 10, 2010 (UTC)

Last two comments were at Where to download Vim. I have moved the comments with Fritzophrenic's new section to this page. JohnBeckett 08:43, July 12, 2010 (UTC)

Need info on how to install the shell extensions (e.g. "edit with Vim" context menu entry) on Windows. Do we have a tip for this already? Also for other stuff included in the standard installation, like 'diff.exe'.

--Fritzophrenic 20:30, August 18, 2010 (UTC)

When you build Vim on Windows, you also get install.exe (built from src/dosinst.c), and I believe you are supposed to run that if you want "Edit with Vim" and file associations. I have never used it. Of course you can manually add "Edit with Vim" with manual registry changes (I don't use these either). There is info at :help gui_w32.txt. The relevant tips are:
The only tip with info on diff.exe is:
JohnBeckett 07:46, August 19, 2010 (UTC)
I assumed this was what the install.exe thing was for, but when I finally uninstalled Vim 7.2 at home (since 7.3 is out of Beta), and ran install.exe, I just got errors about not running it from my vim73 directory (which doesn't exist at all). I suppose I'll post on vim_use about it, and hopefully put that info on the wiki when I figure out how to do it. --Fritzophrenic 14:35, August 19, 2010 (UTC)

Make sure the library names are correct for all or most distributions. In the Linux dist I'm using it seems the libraries are named <X>-devel instead of <X>-dev.

--mikedgreene 15:50 Feb 27, 2011 (UTC)

Advertisement