3.11.2012

vim x github

11 Mar 2012

ゴールは、家でvimrcやpluginを調整し、それを会社でさくっと導入し、より早く開発できるようにすること。で、良さそうなpluginがgithubで公開されているので、家と会社をつなぐのもgithubで。

まずはgit/githubの練習。github.comでアカウント作り、テスト用のリポジトリを作ると、下記のような一連のコマンドが表示されるので簡単。

$ mkdir hello-Git
$ cd hello-Git/
$ git init
$ touch README
$ vi README
$ git add README
$ git commit -m 'first commit'
$ git remote add origin git@github.com:sotaro/hello-Git.git
$ git push -u origin master
$ git push git@github.com:sotaro/hello-Git.git
続いてplugin。
自動補完のneocomplcache + vimproc、リスティング(以外にも使えるらしい)のunite.vim、vim上でコマンドが使えるvimshellの4つと、「vundle」というplugin管理用のpluginの計5つをインストールする。

$ git clone git://github.com/gmarik/vundle.git ~/.vim/vundle.git
$ vi ~/.vimrc
(抜粋)
set nocompatible
filetype off

set rtp+=~/.vim/vundle.git/
call vundle#rc()

Bundle 'Shougo/unite.vim'
Bundle 'Shougo/vimshell'
Bundle 'Shougo/neocomplcache'
Bundle 'Shougo/vimproc'

filetype plugin indent on

let g:neocomplcache_enable_at_startup = 1
とし、vim上で

:BundleInstall
とすれば、インストール完了。
で、いよいよautocompleteを試すべく適当なファイルを編集しようとすると

.vim/bundle/vimproc/autoload/proc.so" is not found.
となり、

:help vimproc
でヘルプを読むとproc.soを作る必要があるとのことで、

$ cd ~/.vim/bundle/vimproc/
$ make -f make_gcc.mak
$ ls autoload/proc.so 
autoload/proc.so
で、いろいろ試すこと数時間。
使いこなすまでには相当の時間を要するが、どれも便利。

会社では

$ sudo apt-get install git-core
$ mkdir ~/.vim ~/github
$ git clone git://github.com/gmarik/vundle.git ~/.vim/vundle.git
$ git clone git://github.com/sotaro/hello-Git.git ~/github/hello-Git.git
$ cp ~/github/hello-Git.git/.vimrc ~/
$ vi .vimrc
(:BundleInstall)
$ cd ~/.vim/bundle/vimproc/
$ make -f make_gcc.mak
で導入できるはず!

0 件のコメント:

コメントを投稿