Skip to content

Instantly share code, notes, and snippets.

@voodoojello
Last active April 22, 2019 22:35
Show Gist options
  • Save voodoojello/ed833090741631b126eb64b1f259f7fb to your computer and use it in GitHub Desktop.
Save voodoojello/ed833090741631b126eb64b1f259f7fb to your computer and use it in GitHub Desktop.
Vim build script for Debian derivatives (8.1)
#!/bin/bash
#
# Vim build script for Debian derivatives (8.1)
#-----------------------------------------------------------
# Modified: Mon Apr 22 22:32:32 2019 +0000
# Author: Mark Page [mark@very3.net]
#
# This script will remove all existing Vim executables
# and libraries and build the latest release from source.
# Scripting support for Ruby, Python, Perl and Lua has
# been enabled.
#
# If your wish is to remove Vim originally installed
# with script, pass "uninstall" as an argument.
#
# For more information see: https://github.com/vim/vim
#-----------------------------------------------------------
#
# Python config locations, check your paths!
PYTHON_CONFIG_DIR=/usr/lib/python2.7/config-x86_64-linux-gnu
PYTHON3_CONFIG_DIR=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu
# Temp build location
TEMP_DIR=/tmp/vim
# Remove all existing Vim apps and libraries
if [ -d "$TEMP_DIR" ]; then
sudo rm -R $TEMP_DIR
fi
sudo apt-get remove vim vim-runtime gvim -y
sudo apt-get remove vim-tiny vim-common vim-gui-common vim-nox -y
# Install/update build enviromment
sudo apt-get update -y
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git -y
# Clone latest Vim from source
cd /tmp
git clone https://github.com/vim/vim.git
# Build and install/uninstall
ARG1=${1:-install}
cd vim
./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --with-python-config-dir=$PYTHON_CONFIG_DIR --enable-python3interp=yes --with-python3-config-dir=$PYTHON3_CONFIG_DIR --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=auto --enable-cscope --prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim81
sudo make $ARG1
# Update Ubuntu/Debian alternatives
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vim vim /usr/local/bin/vim 1
sudo update-alternatives --set vim /usr/local/bin/vim
# Clean up
sudo rm -R $TEMP_DIR
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment