それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

vimrc を書いてNeoBundle を作りなおした

NeoBundle をチャント使うことにした。

vimrc のファイルは、適当に拡張してて、だんだん管理が面倒になって放置していました。 さらに、各種プラグインがどうなってるか調べるのが面倒になった。

neobundle で管理してもらうことにした。

neobundle のインストール。その前に。

既存のvimrc や、プラグインディレクトリを別の場所に、移動しておいた。

mv .vimrc  vimrc-`date -I`.back
mv .vim  vim-dir-`date -I`.back

既存のものを一旦リセットしておいた

基本的な vimrc だけ作っておいた

一番良く使うものでないと困るものをvimrc に記述した

" by takuya
set nocompatible
set history=50
set showcmd
set incsearch
set swapfile
set number 
set tabstop=2
set shiftwidth=4
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,cp932,euc-jp,ucs-2le,ucs-2
set paste
set undofile
set autoindent
colorscheme slate
set ignorecase
"" for mouse
set mouse=a
set ttymouse=xterm2
set t_Co=256
"" for split
set splitbelow
set splitright

とくに、mouse=a と ttymouse がお気に入り。コレがないと死ねる。

NeoBundleをもってきて インストール

mkdir -p ~/.vim/bundle
cd ~/.vim/bundle
git clone https://github.com/Shougo/neobundle.vim.git

vimrc に追記する

$ cat - > ~/.vimrc

 " Note: Skip initialization for vim-tiny or vim-small.
 if !1 | finish | endif

 if has('vim_starting')
   if &compatible
     set nocompatible               " Be iMproved
   endif

   " Required:
   set runtimepath+=~/.vim/bundle/neobundle.vim/
 endif

 " Required:
 call neobundle#begin(expand('~/.vim/bundle/'))

 " Let NeoBundle manage NeoBundle
 " Required:
 NeoBundleFetch 'Shougo/neobundle.vim'

 " My Bundles here:
 " Refer to |:NeoBundle-examples|.
 " Note: You don't set neobundle setting in .gvimrc!

 call neobundle#end()

 " Required:
 filetype plugin indent on

 " If there are uninstalled bundles found on startup,
 " this will conveniently prompt you to install them.
 NeoBundleCheck

最後に ctrl+D を押して入力

neobundle が入ってない環境でも、vimrc を使いまわせるように

vimrc に直接記述しちゃうと、別の環境にvimrc をコピーして使いまわすことができなくなるので、

neobundleが入ってる時だけ起動するように記述を追加

if isdirectory( expand("~/.vim/bundle/neobundle.vim")  )
    " Note: Skip initialization for vim-tiny or vim-small.
    if !1 | finish | endif

    if has('vim_starting')
    if &compatible
    (中略

endif

これで、dotfileを他の環境にコピペしても大丈夫になった。

vimrcをgit の管理下に放り込んで。

cp ~/.vimrc ~/my_dotfiles/
rm ~/.vimrc
ln -s ~/my_dotfiles/.vimrc ~/.vimrc
cd ~/my_dotfiles/
git add .vimrc
git commit -m "neobundle系に伴い設定変更"

最後に、プラグインをインストールしまくる

    " My Bundles here:
    " Refer to |:NeoBundle-examples|.
    " Note: You don't set neobundle setting in .gvimrc!
    NeoBundle 'junegunn/seoul256.vim'
    NeoBundle 'altercation/vim-colors-solarized'
    NeoBundle 'croaker/mustang-vim'
    NeoBundle 'nanotech/jellybeans.vim'
    NeoBundle 'tomasr/molokai'
    NeoBundle 'Shougo/unite.vim'
    NeoBundle 'ujihisa/unite-colorscheme'
    NeoBundle 'thinca/vim-quickrun'
    NeoBundle 'Shougo/unite.vim'
    NeoBundle 'Shougo/vimproc'
    NeoBundle 'scrooloose/nerdtree'

    call neobundle#end()

とりあえず、quickrun-vimとnerdtree さえアレば戦える!