Skip to content

Instantly share code, notes, and snippets.

@yarko
Last active September 12, 2017 23:13
Show Gist options
  • Save yarko/956b801e8f5f1a15ea4d55fb42b9a0a1 to your computer and use it in GitHub Desktop.
Save yarko/956b801e8f5f1a15ea4d55fb42b9a0a1 to your computer and use it in GitHub Desktop.
building Vim w/ Lua support (Linux)

These are my notes on Ubuntu 16.04. It seems generic enough, that I trust it applies to any Linux (perhaps any gcc) build.

I (lazily) had used https://vim.spf13.com vim plugins. The startup error messages were getting annoying, in particular from neocomplete (which needs Lua support). I also had problems from python-mode, but this was unrelated (I ended up removing, then re-installing python-mode, via the :Plugin plugin).

This excursion was triggered by a post about Vim sessions (something I was unaware of - vim-session plugin makes it "usable"). This, in turn, had me exploring various related plugins, tabs and screen-splits (motivations for sessions). Those, in turn, annoyingly increased my noise.

Here is how simple building Vim with Lua support ended up being. To not overwrite the system vi, I installed in my home directory. I additionally linked ~/bin/vi to ~/bin/vim.

To get Vim built with lua support:

  • build and install Lua from sources (don't need *.so lib);
  • Lua source from https://www.lua.org/download.html; I let it install in /usr/local (default);
  • Lua installs headers in /usr/local/include, liblua.a in /usr/local/lib;
  • vim source from https://github.com/vim/vim tree (I built on latest tag - which happened to be master);
  • vim result seems huge, but appears stripped on install to reasonable size (10% smaller than system vim);

Build lua with simply:

$ make linux
$ sudo make install

Then just pass this on to vim configure (python and ruby interps, below, optional as you please):

$ make distclean
#  --prefix is installation for vim;
#  Setting luainterp to "yes", not "dynamic" matters; Lua library is not dynamic;
$ ./configure --prefix=$HOME \
    --with-lua-prefix=/usr/local \
    --enable-luainterp=yes \
    --enable-python3interp=dynamic \
    --enable-rubyinterp=dynamic
$ make
#  test if you like:  `:echo has('lua')` will return '1' if you succeeded, else '0'
$ make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment