LoginSignup
1
2

More than 5 years have passed since last update.

CentOSにlua有効のvimを一般ユーザー権限でインストール

Last updated at Posted at 2017-04-29

neocompleteを使えるようにするためにluaを有効にしたvimをインストール。
luaとvimは一般ユーザー権限でインストールした。

環境

  • CentOS 6.7
  • vim 7.4 8.0
  • lua 5.3.4

luaのインストール

$ cd ~/usr/local/src/
$ wget "http://www.lua.org/ftp/lua-5.3.4.tar.gz"
$ tar xf lua-5.3.4.tar.gz
$ cd lua-5.3.4
$ make linux 
$ make install INSTALL_TOP=$HOME/usr/local

以下はvimのインストールのための設定

$ cd ~/usr/local/src/lua-5.3.4/src
$ mkdir include
$ ln -s *.h ./include

vimのインストール

  • ソースのダウンロード
$ wget "ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2"
$ tar xf vim-7.4.tar.bz2
$ cd vim74

最新版のvimはgithubのレポジトリに置いてある。
https://github.com/vim/vim.git
現在時点で最新のvim 8.0であれば下に書いたエラーは起こらない。

  • インストール
$ ./configure \
     --prefix=$HOME/usr/local \
     --with-features=huge \
     --enable-multibyte \
     --enable-luainterp \
     --with-lua-prefix=$HOME/usr/local/src/lua-5.3.4/src \
     --enable-perlinterp \
     --enable-pythoninterp \
     --with-python-config-dir=/usr/lib64/python2.6/config \
     --enable-rubyinterp \
     --with-ruby-command=/usr/bin/ruby 
$ make
$ make install
  • エラーが出たら

less ./src/auto/config.logでログを確認

今回は"undefined reference to 'luaL_optlong'"なるエラーが出た。

objects/if_lua.o: In function 'luaV_list_insert':
$HOME/usr/local/src/vim74/src/if_lua.c:777: undefined reference to 'luaL_optlong'
collect2: ld returned 1 exit status

これはvim74/src/if_lua.cを以下のように書き換えることで回避できる。

--- long pos = luaL_optlong(L, 3, 0);
+++ long pos = (long)luaL_optinteger(L, 3, 0);

確認

$ vim --versionでluaに+が付いていれば無事に完了。

参考

CentOS7でluaを有効にしたVimに入れ替える
enable-luaなvim7.4をインストール
vim で lua を使えるようにビルドしたメモ
Lua を一般ユーザでソースコードからインストールする

1
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2