LoginSignup
9

More than 5 years have passed since last update.

CentOS7でluaを有効にしたVimに入れ替える

Posted at

環境

  • CentOS 7.2
  • Vim バージョン7.4
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

$ vim --version

入れ替えの目的

  • vimのプラグインneocompleteを使うため

  • 上記プラグインを使用するために必要なlua機能が、yumでインストール済みのvimでは有効になっていなかったため

手順

既存Vimのアンインストール

  • yum list installed | grep vim すると、vim-XXXX.x86_64 が複数インストールされていたが、 vim-enhanced をremoveすれば良いようだ
$ sudo yum remove vim-enhanced

Vimを新規インストール

  • ビルドに必要なツールを先に入れておく

    • lua-devel ncurses-devel をインストール
    • perl-ExtUtils-Embed も必要かもしれません。私の環境では既に入っていました。
$ sudo yum install lua-devel ncurses-devel
  • Vimのソースを入手

    • 入手方法はいくつかあると思いますが、私の場合は GitHub から最新のソースコードをダウンロードしました
    • コンパイル時は、ruby でソースコードを書くので ruby を有効化
$ su - 
※ sudoでも構いません

# cd /usr/local/src/
# git clone https://github.com/vim/vim.git
# cd vim/
# git pull
# make distclean
# ./configure --prefix=/usr/local --with-features=huge --enable-multibyte --enable-rubyinterp --enable-luainterp --enable-cscope --enable-fail-if-missing --with-ruby-command=/home/vagrant/.rbenv/shims/ruby
# make
# make install
  • ハマったところ

    • --with-ruby-command= のオプション指定
    • ここは、rubyの実行ファイルが存在するパスを指定する必要があるようです
  • インストールした Vim で lua が有効になっているか確認

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 22 2016 15:02:29)
適用済パッチ: 1-95
Compiled by vagrant@local.summer-vacation
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
-clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      +lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary

参考にさせて頂いたサイト

CentOSにVim7.4をluaオプション付きでインストールする
enable-luaなvim7.4をインストール
neocompleteを使うために、luaを有効にしたvimの最新版をインストール
CentOS 7.0にLuaを有効にしたvimをインストール

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
9