Skip to content

Instantly share code, notes, and snippets.

@zwhitchcox
Last active September 13, 2019 01:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwhitchcox/66744509ba5ed11c50760b8d5c303e48 to your computer and use it in GitHub Desktop.
Save zwhitchcox/66744509ba5ed11c50760b8d5c303e48 to your computer and use it in GitHub Desktop.
Bash Script to Install Vim With Python Support
#!/bin/bash
PY2_CONFIG_DIR=$(sudo find /usr/lib -type d -regex ".*python2.[0-9]/config[^/]*")
PY3_CONFIG_DIR=$(sudo find /usr/lib -type d -regex ".*python3.[0-9]/config[^/]*")
if ( [ -d "$PY2_CONFIG_DIR" ] || [ -d "$PY3_CONFIG_DIR" ] ) ; then
py2_arg="--with-python-config-dir=$PY2_CONFIG_DIR"
py3_arg="--with-python3-config-dir=$PY3_CONFIG_DIR"
fi
if ( [ ! -x "$(command -v vim)" ] || ! (( $( vim --version | grep -c "+python3") )) ); then
# have to build from source for YouCompleteMe to work
VIM_DIR=$HOME/build/src/vim
mkdir -p $VIM_DIR
git clone https://github.com/vim/vim --depth=1 $VIM_DIR
cd $VIM_DIR
sudo ./configure \
--enable-multibyte \
--enable-fontset \
--enable-xim \
--enable-gui=auto \
--enable-luainterp=yes \
--enable-pythoninterp=yes \
--enable-rubyinterp=yes \
--enable-perlinterp \
--enable-cscope \
--enable-sniff \
--with-x \
--with-compiledby=erocpil \
--with-features=huge \
"$py2_arg" \
"$py3_arg" \
--enable-localmap \
--enable-python3interp=yes \
--enable-gtk-check \
--enable-gui=gtk2 \
--prefix=/usr/local
make -j8
sudo make install
@zwhitchcox
Copy link
Author

In order for YouCompleteMe to work, you have to build vim from source and try to add python support, which is a huge pain.

This does it in just a single script.

@mgedmin
Copy link

mgedmin commented Aug 27, 2019

Why do you use sudo to run ./configure? It should not be needed.

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