Skip to content

Instantly share code, notes, and snippets.

@keenle
Created June 16, 2021 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keenle/9022dcde2cffb355d3575b7f53ea7bb1 to your computer and use it in GitHub Desktop.
Save keenle/9022dcde2cffb355d3575b7f53ea7bb1 to your computer and use it in GitHub Desktop.
Compile Vim with Python and Lua
  • Compile Vim with:
    • Python
    • Python 3
    • Lua
  • Python paths can be different on your machine
  • Remove those options that are not needed
# General tools
apt install -y git make clang
# Python libraries
apt install -y python3-distutils python3-dev 
# Lua libraries
apt isntall -y liblua5.4-dev lua5.4 
# If ncurses lib is missing in your env
apt install -y libncurses-dev
git clone https://github.com/vim/vim.git
cd vim
export VIM_BUILD_PREFIX="/usr/local"
./configure --prefix=$VIM_BUILD_PREFIX \
    --enable-pythoninterp \
    --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
    --enable-python3interp \
    --with-python3-config-dir=/usr/lib/python3.9/config-3.9-x86_64-linux-gnu/ \
    --enable-luainterp \
    --with-compiledby=keenle \
    --with-modified-by=keenle
make
make test
sudo make install

# Copy Vim runtime files
cp ./runtime /usr/local/share/vim

# Configure your Vim as default editor
sudo sh -c "update-alternatives --install /usr/bin/editor editor $VIM_BUILD_PREFIX/bin/vim 1;
update-alternatives --set editor $VIM_BUILD_PREFIX/bin/vim;
update-alternatives --install /usr/bin/vim vim $VIM_BUILD_PREFIX/bin/vim 1;
update-alternatives --set vim $VIM_BUILD_PREFIX/bin/vim;
update-alternatives --install /usr/bin/vi vi $VIM_BUILD_PREFIX/bin/vim 1;
update-alternatives --set vi $VIM_BUILD_PREFIX/bin/vim;"

unset VIM_BUILD_PREFIX

If ./configure fails you need to run make clean before running it again.

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