vim添加lua支持

安装vim8.0可以先参考页面升级安装vim8.0并添加插件支持

一、安装Lua和LuaJIT

LuaJIT下载页面:luajit.org,Lua下载页面:lua.org

1.1 安装lua

wget http://www.lua.org/ftp/lua-5.3.4.tar.gz
tar -zxvf lua-5.3.4.tar.gz
cd lua
make linux test
make install

1.2 安装LuaJIT

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar -zxvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make && make install

二、配置vim

安装lua库:apt-get install lua5.1-dev liblua5,然后进入vim的安装目录安装:

./configure --prefix=/usr/local/vim-8.0 \
 --enable-fail-if-missing \
 --with-features=huge \
 --enable-multibyte \
 --enable-python3interp=yes \
 --enable-luainterp=yes \
 --enable-gui=gtk2 \
 --enable-cscope \
 --with-luajit \
 --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu

--enable-fail-if-missing选项的作用:检测所有插件包的环境是否满足,不满足就停止。

这里如果出现错误则表示环境不满足,检查上面的步骤是否有误。没有错误就可以执行make && make intall安装了。

安装完成后打开vim可能会报错:

vim: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

原因是找不到luajit的库,可以通过find / -name libluajit-5.1.so.2来找到库:

root@ubuntu:~# find / -name "libluajit-5.1.so.2"
/usr/local/lib/libluajit-5.1.so.2
# 找到库后做软链接
root@ubuntu:~# ln -s /usr/local/lib/libluajit-5.1.so.2 /usr/lib/libluajit-5.1.so.2 

查看是否安装成功

root@ubuntu:/data/software# vim --version 
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 27 2018 15:43:37)
Included patches: 1-1616
Compiled by ma@ubuntu
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               -perl              +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua               -ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/vim-8.0/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo -lnsl   -ldl  -L/usr/lib/x86_64-linux-gnu -lluajit-5.1   -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ -lpython3.5m 
最后修改:2018 年 12 月 16 日 02 : 29 PM

发表评论