Re-compile VIM with options

14,979

Solution 1

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

Solution 2

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.

Solution 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

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
Share:
14,979

Related videos on Youtube

bdeonovic
Author by

bdeonovic

I am Benjamin Deonovic, a research scientist at the Corteva. My research interests include Bayesian data analysis, MCMC, computational statistics, bioinformatics, and psychometrics. email: [email protected]

Updated on September 18, 2022

Comments

  • bdeonovic
    bdeonovic over 1 year

    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
    bdeonovic over 10 years
    This will install +clientserver and +conceal options as well? It's a bit frustrating not knowing which --enable flags install the options I want.
  • garyjohn
    garyjohn over 10 years
    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.
  • bdeonovic
    bdeonovic over 10 years
    @garyjohn thats a good tip! The problem for me was not knowing which configure flags would install the appropriate features
  • bdeonovic
    bdeonovic over 10 years
    @IngoKarkat This did not compile with +clientserve =(
  • bdeonovic
    bdeonovic over 10 years
    Nevermind, just forgot to start a new terminal session :)
  • Ingo Karkat
    Ingo Karkat over 10 years
    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.
  • romainl
    romainl over 10 years
    The vim-gnome and vim-gtk packages both intall Vim with everything you need.
  • still_dreaming_1
    still_dreaming_1 about 9 years
    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?
  • Ingo Karkat
    Ingo Karkat about 9 years
    @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 #defines that compile Vim with Python support.
  • bdeonovic
    bdeonovic about 9 years
    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 github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-sou‌​rce