Ubuntu 9.10 Server に vim をインストール。


デフォルトで入ってるvimはHuge版なので大部分の機能が有効になってるんだけど、rubyのアレとかが有効になってない。

$ vi --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 21 2009 11:22:49)
適用済パッチ: 1-245
Compiled by buildd@rothera.buildd
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand 
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap 
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte 
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript 
+printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind 
+signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
      システム vimrc: "$VIM/vimrc"
        ユーザ vimrc: "$HOME/.vimrc"
         ユーザ exrc: "$HOME/.exrc"
       省略時の $VIM: "/usr/share/vim"
コンパイル: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -Wall -g -O2     -I/usr/include/python2.6 -pthread   
リンク: gcc   -Wl,--as-needed -o vim       -lncurses -lselinux  -lacl -lgpm -L/usr/lib/python2.6/config -lpython2.6 -L/usr/lib -lz -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions


で、9.04みたいにvim-full入れようかなと思ったら、vim-fullがない。

$ aptitude search vim
v   gvim                                         -                                                             
p   iceweasel-vimperator                         - Iceweasel extension to make it have vim look and feel.      
p   jvim-canna                                   - Japanized VIM (Canna version)                               
p   jvim-doc                                     - Documentation for jvim (Japanized VIM)                      
i   vim                                          - Vi IMproved - enhanced vi editor                            
p   vim-addon-manager                            - manager of addons for the Vim editor                        
i   vim-common                                   - Vi IMproved - Common files                                  
p   vim-dbg                                      - Vi IMproved - enhanced vi editor (debugging symbols)        
p   vim-doc                                      - Vi IMproved - HTML documentation                            
p   vim-gnome                                    - Vi IMproved - enhanced vi editor - with GNOME2 GUI          
p   vim-gtk                                      - Vi IMproved - enhanced vi editor - with GTK2 GUI            
p   vim-gui-common                               - Vi IMproved - Common GUI files                              
p   vim-latexsuite                               - view, edit and compile LaTeX documents from within Vim      
p   vim-nox                                      - Vi IMproved - enhanced vi editor                            
v   vim-perl                                     -                                                             
v   vim-python                                   -                                                             
p   vim-rails                                    - plugins for vim to allow easier editing of Rails Application
v   vim-ruby                                     -                                                             
i   vim-runtime                                  - Vi IMproved - Runtime files                                 
p   vim-scripts                                  - plugins for vim, adding bells and whistles                  
p   vim-syntax-gtk                               - Syntax files to highlight GTK+ keywords in vim              
v   vim-tcl                                      -                                                             
i   vim-tiny                                     - Vi IMproved - enhanced vi editor - compact version          
p   vim-vimoutliner                              - script for building an outline editor on top of Vim         
p   vimhelp-de                                   - Vi IMproved - Documentation files (German translation)


vim-noxってやつが全部盛りっぽい。

$ aptitude show vim-nox
パッケージ: vim-nox
新規: yes
状態: インストールされていません
バージョン: 2:7.2.245-2ubuntu2
優先度: 特別
セクション: universe/editors
メンテナ: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
展開サイズ: 1,888k
依存: vim-common (= 2:7.2.245-2ubuntu2), vim-runtime (= 2:7.2.245-2ubuntu2), libacl1 (>= 2.2.11-1), libc6 (>= 2.4),
        libgpm2 (>= 1.20.4), libncurses5 (>= 5.6+20071006-3), libperl5.10 (>= 5.10.0), libpython2.6 (>= 2.6),
        libruby1.8 (>= 1.8.7.174), libselinux1 (>= 2.0.85), tcl8.4 (>= 8.4.16)
提案: cscope, vim-doc
提供: editor, vim, vim-perl, vim-python, vim-ruby, vim-tcl
説明: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi. 
 
 Many new features have been added: multi level undo, syntax highlighting, command line history, on-line help,
 filename completion, block operations, folding, Unicode support, etc. 
 
 This package contains a version of vim compiled with support for scripting with Perl, Python, Ruby, and Tcl but no
 GUI.
ホームページ: http://www.vim.org/


ということでインストール。

$ sudo aptitude install vim-nox


無事にrubyのアレや、perlのアレも有効になってます。

$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 21 2009 11:21:59)
適用済パッチ: 1-245
Compiled by buildd@rothera.buildd
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand 
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap 
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte 
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl +postscript 
+printer +profile +python +quickfix +reltime +rightleft +ruby +scrollbind 
+signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
      システム vimrc: "$VIM/vimrc"
        ユーザ vimrc: "$HOME/.vimrc"
         ユーザ exrc: "$HOME/.exrc"
       省略時の $VIM: "/usr/share/vim"
コンパイル: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -Wall -g -O2    -D_REENTRANT -D_GNU_SOURCE -DDEBIAN  -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.10/CORE  -I/usr/include/python2.6 -pthread -I/usr/include/tcl8.4  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  -I/usr/lib/ruby/1.8/i486-linux 
リンク: gcc   -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic  -Wl,-E  -Wl,--as-needed -o vim       -lncurses -lselinux  -lacl -lgpm -Wl,-E  -L/usr/local/lib  -L/usr/lib/perl/5.10/CORE -lperl -L/usr/lib/python2.6/config -lpython2.6 -L/usr/lib -lz -lutil -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.4 -lieee -lruby1.8 -lrt -lm


~/.vimrcはこんな感じ。ほとんど何もない。

set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set nocompatible
set backspace=2
syntax on
filetype on
filetype indent on
filetype plugin on
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1

imap <C-o> <C-x><C-o>

"ステータス行を表示
set laststatus=2

"ステータス行の指定
set statusline=%<%f\ %m%r%h%w
set statusline+=%{'['.(&fenc!=''?&fenc:&enc).']['.&fileformat.']'}
set statusline+=%=%l/%L,%c%V%8P

"コメントの自動挿入しない
autocmd FileType * setlocal formatoptions-=ro

"rubyマジックコメント
iab u8 # -*- coding: utf-8 -*-


vim-rubyとかは組み込まれてるので改めてインストールしなくても、syntaxハイライトやオムニ補完は使える。rails.vimは入ってなさげなので必要なら入れる。