19

I have VIM installed but I need to compile it with specific options:

In addition to the most commonly used features, the plugin
       requires: +python or +python3, +clientserver and +conceal.

What are steps to uninstall, and recompile with those options without breaking anything?

bdeonovic
  • 527
  • 1
  • 3
  • 12

3 Answers3

19

When you compile vim you can pass the option/flag --with-features, e.g.:

--with-features=huge

This will determine which features are included in the install. A list of all features can be found here (http://vimdoc.sourceforge.net/htmldoc/various.html) with a letter indicating which version the feature is included in:

Here is an overview of the features.
            The first column shows the smallest version in which
            they are included:
               T    tiny
               S    small
               N    normal
               B    big
               H    huge
               m    manually enabled or depends on other features
             (none) system dependent
            Thus if a feature is marked with "N", it is included
            in the normal, big and huge versions of Vim.

For example if you wanted arabic language feature you would have to have --with-features=big

                            *+feature-list*

   *+ARP*       Amiga only: ARP support included

B  *+arabic*        |Arabic| language support

N  *+autocmd*       |:autocmd|, automatic commands

... etc
Eric Leschinski
  • 6,828
  • 6
  • 45
  • 51
bdeonovic
  • 527
  • 1
  • 3
  • 12
  • This says "When you compile vim you can pass the option:...". It then goes on to show the huge option to get all/most features or something like that. What exactly do I pass that option to? Can I see an example? – still_dreaming_1 Mar 11 '15 at 04:21
  • 1
    The standard way of installing sourcepackages in linux applies here. Download the source code, run `./configure`, run `sudo make install`. It is during the `./configure` step that you can add options such as `--with-features``. See step 3 in https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source – bdeonovic Mar 11 '15 at 11:27
17

First, you need to get the source code, easiest through Vim's Mercurial repository; see vim.org for details.

Then, you need a build environment and the dev libraries, especially for the desired Python. This greatly depends on the platform. On Ubuntu / Debian, it's a simple

$ sudo apt-get build-dep vim-gnome

An Internet search will tell you more.

To compile with the features, you pass those to

$ ./configure --enable-pythoninterp --enable-python3interp

Watch its detection output closely.

Finally, you can compile and install:

$ make
$ sudo make install

This will (on Linux) install Vim to /usr/local/bin/vim, so it doesn't interfere with the default /usr/bin/vim, and you don't need to uninstall anything; just make sure that the former comes first in your PATH.

Ingo Karkat
  • 22,638
  • 2
  • 45
  • 58
  • This will install +clientserver and +conceal options as well? It's a bit frustrating not knowing which --enable flags install the options I want. – bdeonovic Jan 28 '14 at 16:27
  • Something else you might do is save the build configuration you have now with this command, `vim --version > vim-version.orig` and compare that with the output of `vim --version` after you've re-compiled vim. That will let you know if there are any features you used to have that did not get included in the re-compiled version. – garyjohn Jan 28 '14 at 16:27
  • @garyjohn thats a good tip! The problem for me was not knowing which configure flags would install the appropriate features – bdeonovic Jan 28 '14 at 16:29
  • @IngoKarkat This did not compile with +clientserve =( – bdeonovic Jan 28 '14 at 16:36
  • Nevermind, just forgot to start a new terminal session :) – bdeonovic Jan 28 '14 at 16:41
  • 2
    By default, "most" features are enabled (if the dev libraries are there). To be sure, you can pass `--with-features=huge` to have everything in there. – Ingo Karkat Jan 28 '14 at 16:45
  • 2
    The `vim-gnome` and `vim-gtk` packages both intall Vim with everything you need. – romainl Jan 28 '14 at 18:09
  • I'm confused. This says "To compile with the features..." To compile with what features? What exactly is happening at `./configure --enable-pythoninterp --enablepython3interp`? – still_dreaming_1 Mar 11 '15 at 04:17
  • @INTPnerd: Those are for the Python 2 and 3 interpreters. The `--enable-...` tell configure to check for the existence of the corresponding dev libraries and headers, and if everything's there, add the proper `#define`s that compile Vim with Python support. – Ingo Karkat Mar 11 '15 at 07:52
3

Configure, Compile and Install Vim

Install required libraries

sudo apt-get build-dep vim

Download the latest VIM version from github, e.g.

mkdir -p ./git/vim; cd ./git/vim
git clone https://github.com/vim/vim

The most practical way to make the configuration is to set configuration options directly in the Makefile. First make a copy of the Makefile

cp ./src/Makefile ./src/Makefile.backup

If you are familiar with git the last step isn't necessary since you can easily restore the origin state of all files with git clean -dfX or simple restore the Makefile with git restore Makefile.

If you prefer to compile a official release you have to checkout as so called tag. To list available tags type git tag --list. To compile such a release you have to checkout a tag like git checkout v9.0.1440. From my experience there is noting wrong by directly compile the so called master branch (up to date source code).

Afterwards open the ./src/Makefile and then uncomment (delete the #) lines you like to be compiled and installed.

vi ./src/Makefile

To adapt features you have to edit the src/feature.h file

vi ./src/feature.h

It is recommended for unix to make the basic choice by adding it to the configure command.

Basic choices are:

  • tiny - almost no features enabled, not even multiple windows
  • small - few features enabled, as basic as possible
  • normal - a default selection of features enabled
  • big - many features enabled, as rich as possible
  • huge - all possible features enabled

Then configure vim to apply your settings

./configure --with-features=huge

Afterwards simply compile

make -j `nproc` # compile with max. number of processors

and install it with

sudo make install
abu_bua
  • 369
  • 5
  • 7