vim 重新编译,支持lua (compile vim with lua)

1. ncurses 安装

官网下载:http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

CSDN 下载:http://download.csdn.net/detail/spch2008/8828779

tar -xf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure
make
sudo make install

 

2. lua 安装  

官方网下载:http://www.lua.org/download.html

CSDN 下载:http://download.csdn.net/detail/spch2008/8828787

tar -xf lua-5.3.1.tar.gz
cd lua-5.3.1
make linux
sudo make install

 

问题一:

error: readline/readline.h: No such file or directory

下载readline

CSDN下载:http://download.csdn.net/detail/spch2008/8828777

cd readline-5.2
./configure
sudo make
sudo make install

 

问题二:

复制代码
//usr/local/lib/libreadline.so: undefined reference to `tputs'
//usr/local/lib/libreadline.so: undefined reference to `tgoto'
//usr/local/lib/libreadline.so: undefined reference to `tgetflag'
//usr/local/lib/libreadline.so: undefined reference to `UP'
//usr/local/lib/libreadline.so: undefined reference to `tgetent'
//usr/local/lib/libreadline.so: undefined reference to `tgetnum'
//usr/local/lib/libreadline.so: undefined reference to `PC'
//usr/local/lib/libreadline.so: undefined reference to `tgetstr'
//usr/local/lib/libreadline.so: undefined reference to `BC'
collect2: error: ld returned 1 exit status
复制代码

添加 -lncurses 参数

 /home/spch2008/lua-5.3.1/src/Makefile

linux:
110     $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"

 

3. vim 安装

官方下载:ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2

CSDN下载:http://download.csdn.net/detail/spch2008/8828773

tar -xf  vim-7.4.tar.bz2
cd vim74
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-luainterp --with-lua-prefix=/usr/local
sudo make
sudo make install

可以将输出重定向到log文件中,查看configure输出:

cat log | grep lua

复制代码
spch2008@ubuntu:~/vim74$ cat log | grep lua
checking --enable-luainterp argument... yes
checking --with-lua-prefix argument... /usr/local
checking --with-luajit... no
checking for lua... /usr/local/bin/lua
checking if lua.h can be found in /usr/local/include... yes
checking if link with -L/usr/local/lib -llua is sane... yes
复制代码

 

问题:

objects/if_lua.o: In function `luaV_list_insert':
/home/spch2008/vim74/src/if_lua.c:777: undefined reference to `luaL_optlong'
collect2: error: ld returned 1 exit status

修改文件 /home/spch2008/vim74/src/if_lua.c

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

 

4. 安装成功,检测时间,可能遇到问题

打开vim,输入:version, 查看vim编译时间,如果是本次编译生成,则说明正确,然后查看是否有+lua

若编译时间不正确,则删除旧vim,拷贝新的vim程序

sudo rm -f /usr/bin/vim
sudo rm -f /usr/local/bin
sudo cp ~/vim74/src/vim /usr/bin
sudo cp ~/vim74/src/vim /usr/local/bin

 

附:

更改$VIM变量。编译完成后,我的$VIM变量是/usr/share/vim,一般默认都是在/etc,因而进行修改。

上图,输入version查看,vim 读取全局配置文件vimrc的路径为$VIM,通过:echo $VIM,

可知,目前我的VIM路径为/usr/share/vim。

在os_unix.h文件中,改为:# define SYS_VIMRC_FILE "/etc/vimrc"。重新进行make, make install 即可。

 

查看vim加载的脚本,输入:scriptnames 。可以看到vim已经加载的文本。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值