21

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
  • 567

3 Answers3

21

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
  • 7,393
  • 7
  • 51
  • 51
bdeonovic
  • 567
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
  • 23,523
5

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
  • 558
  • 9
  • 9