Skip to content

Instantly share code, notes, and snippets.

@yarko
Forked from leolord/vim.sh
Last active December 8, 2021 18:14
Show Gist options
  • Save yarko/af95b2b560d5eee5b48743299cfb00c9 to your computer and use it in GitHub Desktop.
Save yarko/af95b2b560d5eee5b48743299cfb00c9 to your computer and use it in GitHub Desktop.
Compiling vim on Ubuntu 18 with LUA-support
# my build: (Ubuntu 20.04)
# see notes (2/12/2020):
# https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source
# be sure we have libgtk-3-dev installed
# sudo apt install libgtk-3-dev
./configure \
--with-features=huge \
--enable-multibyte \
--enable-luainterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=$(python3.11-config --configdir) \
--enable-cscope \
--disable-netbeans \
--enable-terminal \
--enable-fontset \
--enable-fail-if-missing \
--enable-gui=gtk3 \
--with-compiledby=yarko \
--with-modified-by=yarko
# then, simply:
make VIMRUNTIMEDIR=/usr/share/vim/vim82
sudo checkinstall
sudo cp -fr runtime/* /usr/share/vim/vim82
# then:
# apt doesn't seem to be working; let's dpkg instead:
# sudo apt install ./$(ls -rt vim*.deb | tail -1)
sudo dpkg -i ./$(ls -rt vim*.deb | tail -1)
# Ubuntu keeps un-holding "vim" package on me, so I need to keep
# se-setting hold, and re-installing:
sudo apt-mark showhold
# or:
dpkg --get-selections
# then, if needed:
sudo apt-mark hold vim vim-common vim-runtime
# or, for each:
echo "vim hold" | sudo dpkg --set-selections
## See also: https://gist.github.com/5f86346208be23a523e0c4ad7674dca7.git source gist;
#
# Remove previous installations
## NOTE: removing prev installs just causes them to re-install w/ system update;
# and they then remove *this* install (!). Building w/ system vi in place
# seems fine, given that all these paths / libs are in place
# - so maybe the way to go is skip this "remove":
# sudo apt-get remove vim vim-runtime vim-tiny vim-common
# to prevent this vim from getting auto-removed: (vim-common, vim-runtime are to keep system vim, which will stay in /usr/bin, etc.)
sudo apt-mark hold vim vim-common vim-runtime
# Install dependencies
# -- not sure python dev dependencies from ubuntu are what are useful here... but...
sudo apt-get install libncurses5-dev python-dev liblua5.3-dev lua5.3 python3-dev
# Fix liblua paths
# You have to compile luajit for yourself.
sudo ln -s /usr/include/lua5.3 /usr/include/lua
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/local/lib/liblua.so
sudo ln -sf /usr/bin/luac5.3 /etc/alternatives/lua-compiler
sudo ln -sf /usr/share/man/man1/luac5.3.1.gz /etc/alternatives/lua-compiler-manual
sudo ls -sf /usr/bin/lua5.3 /etc/alternatives/lua-interpreter
sudo ln -sf /usr/share/man/man1/lua5.3.1.gz /etc/alternatives/lua-manual
# Clone vim sources
cd ~
git clone https://github.com/vim/vim.git
cd vim
export ME=yarko
./configure \
--enable-luainterp \
# --enable-pythoninterp \
# --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
--enable-python3interp \
--with-python3-config-dir=/usr/local/lib/python3.8/config-3.8m-x86_64-linux-gnu/ \
--enable-cscope \
--disable-netbeans \
--enable-terminal \
--with-features=huge \
--enable-fontset \
--enable-multibyte \
--enable-fail-if-missing \
--with-compiledby=${ME} \
--with-modified-by=${ME}
make VIMRUNTIMEDIR=/usr/share/vim/vim81
mkdir /usr/share/vim/vim81
sudo apt-get install checkinstall
sudo checkinstall
sudo cp -fr runtime/* /usr/share/vim/vim81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment