LoginSignup
26
25

More than 5 years have passed since last update.

NeoBundle周りを自動化する

Last updated at Posted at 2014-02-19

概要

新しい環境に vim を入れる際、いちいち NeoBundle の準備をするのが面倒臭い。
じゃあ NeoBundle 周りは vim にやらせよう。

手順

NeoBundleの取得

NeoBundleが未取得なら、git clone を呼び出す

base.vim
if has('vim_starting')
  if !isdirectory(expand("~/.vim/bundle/neobundle.vim/"))
    echo "install neobundle..."
    :call system("git clone git://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim")
  endif
  set runtimepath+=~/.vim/bundle/neobundle.vim
endif

call neobundle#rc(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundleInstall の自動化

未取得の bundle があれば、起動時に取得

base.vim
" 先に Bundle の設定をする
" 例
" NeoBundle 'tomasr/molokai'
" colorscheme molokai

" vimrc の最後に書く
if(!empty(neobundle#get_not_installed_bundle_names()))
  echomsg 'Not installed bundles: '
    \ string(neobundle#get_not_installed_bundle_names())
  if confirm('Install bundles now?', "yes\nNo", 2) == 1
    " vimrc を再度読み込み、インストールした Bundle を有効化
    " vimrc は必ず再読み込み可能な形式で記述すること
    NeoBundleInstall
    source ~/.vimrc
  endif
end

リポジトリ

人の設定から切り貼りした後が随所に……

関連

エディタ戦争では中立ゆえ、 emacs 版も近々書きます

26
25
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
26
25