Skip to content

Instantly share code, notes, and snippets.

@j-jith
Last active November 6, 2023 17:30
Show Gist options
  • Save j-jith/f25fbcb826dff37a28bd190b584afd04 to your computer and use it in GitHub Desktop.
Save j-jith/f25fbcb826dff37a28bd190b584afd04 to your computer and use it in GitHub Desktop.
How to compile and install Vim 8.0 on Ubuntu

Install build dependencies

$ sudo apt-get build-dep vim

Clone git repo

$ git clone https://github.com/vim/vim.git

Change to src directory

$ cd vim/src

Remove files from previous compilation (skip if compiling for the first time)

$ sudo make distclean

Path to install vim (optional. omit --prefix option in next step if not set)

export PREFIX='/path/to/vim/install'

Configure with required options ($ configure --help for other config. options)

  • For python 2.x
$ ./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp \
            --enable-pythoninterp \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
            --enable-perlinterp \
            --enable-luainterp \
            --enable-cscope \
            --enable-gui=auto \
            --enable-gtk2-check \
            --with-x \
            --with-compiledby="j.jith" \
            --prefix=$PREFIX
  • For python 3.x
$ ./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp \
            --enable-python3interp \
            --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \
            --enable-perlinterp \
            --enable-luainterp \
            --enable-cscope \
            --enable-gui=auto \
            --enable-gtk2-check \
            --with-x \
            --with-compiledby="j.jith" \
            --prefix=$PREFIX

Compile

$ make

Run tests

$ make test

Install (may need to use sudo if you don't have write permission in $PREFIX)

$ make install

Make default editor/vim/vi/gvim

$ sudo sh -c "update-alternatives --install /usr/bin/editor editor $PREFIX/bin/vim 1;
update-alternatives --set editor $PREFIX/bin/vim;
update-alternatives --install /usr/bin/vim vim $PREFIX/bin/vim 1;
update-alternatives --set vim $PREFIX/bin/vim;
update-alternatives --install /usr/bin/vi vi $PREFIX/bin/vim 1;
update-alternatives --set vi $PREFIX/bin/vim;
update-alternatives --install /usr/bin/gvim gvim $PREFIX/bin/gvim 1;
update-alternatives --set gvim $PREFIX/bin/gvim"
@siuoly
Copy link

siuoly commented Aug 16, 2022

For vim9.0.217 now It still work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment