300億円欲しい

メジャーリーグのデータ解析します

Vimrcを晒す

Vimrcを晒します

好きなプラグイン

NeoBundle

NeoBundleだけインストールしておけば, 後はvimrcにちょちょっと書くだけです.
全てはNeoBundleから始まります.
http://kazyury.hatenadiary.jp/entry/2013/04/30/235944

quickrun

コード書いて即実行するのに超便利
http://d.hatena.ne.jp/osyo-manga/20130311/1363012363

vimproc

色々使うのに必要なのでとりあえず入れる
http://nauthiz.hatenablog.com/entry/20101107/1289140518

neosnippet

スニペット補完 かなり凄い
http://kazuph.hateblo.jp/entry/2012/11/28/105633

neco-look

英語辞書を利用して補完
http://vim-users.jp/2011/03/hack208/

Vimrcを晒す

"カーソル位置を目立たせる
set cursorline
set cursorcolumn
hi clear CursorLine
set hlsearch
nnoremap <esc><esc> :nohlsearch<cr><esc>:set nopaste<cr>

" 色々 set
" よく分からん
set number
set clipboard=unnnamed
set clipboard=autoselect
set smartindent
set ruler
syntax on
set shiftwidth=2
set nocompatible 
set smarttab
set tabstop=1
set expandtab
set softtabstop=2
set showcmd
set autoindent
set backspace=indent,eol,start
set list
set title
set nrformats-=octal
set noswapfile
set linebreak
set autoread
set completeopt=menuone
set nobackup
set listchars=tab:»-,trail:-,eol:,extends:»,precedes:«,nbsp:%


" F2, F3 でバッファの切替
map <F2> <esc>:bp<cr>
map <F3> <esc>:bn<cr>

" 全角スペースを見やすく表示する
" set list するより好きです

if has('syntax')
  syntax enable
  function! ActivateInvisibleIndicator()
    highlight ZenkakuSpace cterm=underline ctermfg=darkgrey gui=underline guifg=#FF0000
    match ZenkakuSpace / /
  endfunction
  augroup InvisibleIndicator
    autocmd!
    autocmd BufEnter * call ActivateInvisibleIndicator()
  augroup END
endif

" 矢印キーの有効化 (甘え)
inoremap OA <up>
inoremap OB <down>
inoremap OC <right>
inoremap OD <left>

" カッコ等の入力補助
inoremap {} {}<LEFT>
inoremap [] []<LEFT>
inoremap () ()<LEFT>
inoremap "" ""<left>
inoremap '' ''<left>
inoremap $$ $$<left>
inoremap <> <><left>
inoremap `` ``<left>

" snippetがあれば要らない
"inoremap {<cr> {}<left><cr><BS><cr><up><tab>

imap <expr><TAB> pumvisible() ? "\<C-n>" : neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"


" コピペ用 (Mac用)
vnoremap <C-c> y:call system("pbcopy", getreg("\""))<CR>
nnoremap <Space><C-v> :call setreg("\"",system("pbpaste"))<CR>p

" 全選択 全コピー (甘え)
nnoremap <F5> ggVG
nnoremap <F6> :%y<cr> 

" vim-smartchrの利用
" 矢印は","を連打すれば出てくるようにできる
" HaskellやRで便利
" 思案中
inoremap <buffer> <expr> , smartchr#loop(',' , '<-', '->',  '<=', '=>')
inoremap <buffer> <expr> - smartchr#loop('-', '--', '------------------------------')
inoremap <buffer> <expr> = smartchr#loop('=', '==',  ' = ', ' == ')

" 移動の補助
inoremap <C-h> <left>
inoremap <C-l> <right>
inoremap <C-k> <up>
inoremap <C-j> <down>
inoremap <C-d> <delete>

" タイポ対策
" {} は届かない
inoremap `* {}<left>

" C-space にESCの割り当て
" Google 日本語入力と合わせて, IMEをオフにする
inoremap <Nul> <esc>
vnoremap <Nul> <esc>
nnoremap <Nul> <esc>

" コンパイルと実行 (甘え)
" quickrun 使え
autocmd FileType r nnoremap <C-e> :w!<cr><esc>:! R -q -f %<cr>
autocmd FileType cpp nnoremap <C-w> :! ./%<
autocmd FileType cpp nnoremap <C-e> :w!<cr><esc>:! g++  -o %< % 
autocmd FileType haskell nnoremap <C-w> :! ./%<
autocmd FileType haskell nnoremap <C-e> :w!<cr>:! ghc %
autocmd FileType sh nnoremap <C-w> :! ./%
autocmd FileType sh nnoremap <C-e> :w!<cr>:! chmod u+x %
autocmd FileType d nnoremap <C-e>:w!<cr>:! dmd -run %
autocmd FileType tex inoremap \() \left(\right)<esc>6<left>i

" 行末、行頭への移動
nnoremap  <C-y> $
inoremap  <C-y> <esc>$i<right>

" 最後に変更した場所へ戻る
map <C-m> `.

" コロン付き改行とただの改行(甘え)
inoremap <C-o> <esc>$i<right><Enter>
inoremap <C-g> <esc>$i<right>;<Enter>

" Vimshell関連
" よく分からん
"
nnoremap <silent> ,is :VimShell<cr>
nnoremap <silent> ,irr :VimShellInteractive R -q <cr>
nnoremap <silent> ,ih  :VimShellInteractive ghci<cr>
vnoremap <silent> ,ss :VimShellSendString<cr>
inoremap <silent> ,ss <esc>:VimShellSendString<cr>
nnoremap <silent> ,ss <S-v>:VimShellSendString<cr>
nnoremap <silent> ,rr ggVG:VimShellSendString<cr>





" Plugin key-mappings.
" snippetの展開
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)

"  ページ移動関連 
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
nnoremap n nzz
nnoremap N Nzz

" ウィンドウの移動
" ウィンドウを分割してこれで移動する
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h

" 新しいウィンドウは右に, 下に
set splitbelow
set splitright

" vimrcを開く
nnoremap ,vim :vsplit<cr><C-l>:e! $HOME/_vimrc<cr>

" 色々開けるように
set fileencodings=iso-2022-jp,euc-jp,cp932,ucs-bom,utf-8,default,latin1


" neocomplcacheの設定
" 起動
let g:neocomplcache_enable_at_startup = 1
"let g:neocomplcache_enable_underbar_completion = 1
"
"let g:neocomplcache_enable_camel_case_completion = 1
"let g:neocomplcache_enable_underbar_completion = 1

" 補完候補を20個表示
let g:neocomplcache_max_list = 20
let g:neocomplcache_min_syntax_length = 3

"let g:unite_cursor_line_highlight = 'Search'
let g:unite_abbr_highlight = 'StatusLine'


" quickrunの設定
let g:quickrun_config ={}

" 理系だから 
autocmd FileType tex nnoremap \cor :%s/。/. /g <cr>:%s/、/, /g<cr>

" Rでquickrunは動かない説
let g:quickrun_config.R = {'command' : 'R -f %<cr>'}


" バッファの開き方を設定
" 一番下に水平分割してウィンドウを開く
" ウィンドウの高さは 8行
let g:quickrun_config = {
\         "_" : {
\       "outputter/buffer/split" : ":botright 8sp",
\       "runner" : "vimproc",
\       "runner/vimproc/updatetime" : 40,
\       "hook/time/enable": 1,
\   }
\}

" persitent undo 

if has('persistent_undo')
        set undodir=~/.vim/undo
        set undofile
endif

" ファイルを開いたら前回の編集点にカーソルが置かれるように
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\""


" NeoBundleの設定

 if has('vim_starting')
   set runtimepath+=~/.vim/bundle/neobundle.vim/
 endif

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

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

 " Recommended to install
 " After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile

"神神&神
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/vimproc'
NeoBundle 'Shougo/vimshell'
NeoBundle 'Shougo/neosnippet'
"NeoBundle 'Shougo/vimfiler'

"神
NeoBundle 'thinca/vim-quickrun'

"神
NeoBundle 'chrismetcalf/vim-yankring'
"神
NeoBundle 'TwitVim'
NeoBundle 'ujihisa/unite-colorscheme'
NeoBundle 'nanotech/jellybeans.vim'
NeoBundle 'osyo-manga/unite-quickfix'
"NeoBundle 'YankRing.vim'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'kana/vim-smartchr'
"辞書の利用
NeoBundle 'https://github.com/ujihisa/neco-look.git'
"SAN値ピンチ
NeoBundle 'osyo-manga/quickrun-hook-santi_pinch'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'yonchu/accelerated-smooth-scroll'
"検索結果が見やすくなる
NeoBundle 'osyo-manga/vim-anzu'
"Vimがしゃべる
NeoBundle 'supermomonga/shaberu.vim'
"ウィンドウサイズの変更が楽になる神
NeoBundle 'git://github.com/jimsei/winresizer.git'
NeoBundle 'deris/vim-duzzle'
"NeoBundle 'vim-scripts/Vim-R-plugin'
"NeoBundle 'ervandew/screen'


" haskell用
NeoBundle 'ujihisa/neco-ghc'
NeoBundle 'dag/vim2hs'

NeoBundleCheck

filetype plugin indent on
" jellybeansが目に優しくていいと思います
:colorscheme jellybeans


"warning" が含まれている分だけアニメーション速度が速くなる
" アニメーションの速度は &updatetime や runner/vimproc/updatetime に影響される
"
" santi   : 低いほどアニメーションが速くなる
" keyword : 出力するテキストに単語が含まれている回数分だけ santi が減る
" rate    : santi が減る割合
" min     : santi の最小値
"
" santi を下げる場合は下記のような outputter に buffered を含める必要がある
" buffered じゃなくて quickfix でも可
let g:quickrun_config = {
\   "_" : {
    \       "hook/santi_pinch/santi" : 10,
\       "hook/santi_pinch/keyword" : "warning",
\       "hook/santi_pinch/rate" : 1.0,
\       "hook/santi_pinch/min" : 4,
\       "runner" : "vimproc",
\       "runner/vimproc/updatetime" : 60,
\       "runner/vimproc/sleep" : 10,
\       "outputter" : "multi:buffer:buffered",
\       "outputter/buffered/target" : "null"
\   }
\}


" 200行ヤンク
" '20  - remember marks for 20 previous files
" \"200 - save 200 lines for each register
" :20  - remember 20 items in command-line history
" %    - remember the buffer list (if vim started without a file arg)
" n    - set name of viminfo file

set viminfo='20,\"200,:20,%,n~/.viminfo 

" Twitvim 関連
let twitvim_count = 40
nnoremap <C-t> :<C-u>PosttoTwitter<CR>
nnoremap ,tf :<C-u>FriendsTwitter<CR><C-w>j
nnoremap ,tu :<C-u>UserTwitter<CR><C-w>j
nnoremap ,tr :<C-u>RepliesTwitter<CR><C-w>j
nnoremap ,tn :<C-u>NextTwitter<CR>

autocmd FileType twitvim call s:twitvim_my_settings()
function! s:twitvim_my_settings()
  set nowrap
endfunction
syntax on
filetype detect

" 勉強用に作った関数
function! SaveBackup ()
 let b:backup_count = exists('b:backup_count') ? b:backup_count+1 : 1
 return writefile(getline(1,'$'), bufname('%') . '_' . b:backup_count)
endfunction
nnoremap  ;b :call SaveBackup ()<cr>


""" unite.vim
"" コピペしただけ まだ何も分かっていない
" 入力モードで開始する
let g:unite_enable_start_insert=1
" バッファ一覧
nnoremap <silent> ,ub :<C-u>Unite buffer<CR>
" ファイル一覧
nnoremap <silent> ,uf :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
" レジスタ一覧
nnoremap <silent> ,ur :<C-u>Unite -buffer-name=register register<CR>
" 最近使用したファイル一覧
nnoremap <silent> ,um :<C-u>Unite file_mru<CR>
" 常用セット
nnoremap <silent> ,uu :<C-u>Unite buffer file_mru<CR>
" 全部乗せ
nnoremap <silent> ,ua :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR>
" ウィンドウを分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-j> unite#do_action('split')
au FileType unite inoremap <silent> <buffer> <expr> <C-j> unite#do_action('split')
" ウィンドウを縦に分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit')
au FileType unite inoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit')
" ESCキーを2回押すと終了する
au FileType unite nnoremap <silent> <buffer> <ESC><ESC> q


"" smooth-scroll
"" <C-d>/<C-u> 時のスリープ時間 (msec) : 小さくするとスクロールが早くなります。
"" Default : 10
"let g:ac_smooth_scroll_du_sleep_time_msec = 2
"
"" <C-f>/<C-b> 時のスリープ時間 (msec) : 小さくするとスクロールが早くなります。
"" Default : 10
"let g:ac_smooth_scroll_fb_sleep_time_msec = 2 " <C-d>/<C-u> 時のスリープ時間 (msec) : 小さくするとスクロールが早くなります。
"" Default : 10
"let g:ac_smooth_scroll_du_sleep_time_msec = 2
"
"" <C-f>/<C-b> 時のスリープ時間 (msec) : 小さくするとスクロールが早くなります。
"" Default : 10
"let g:ac_smooth_scroll_fb_sleep_time_msec = 2  


" vim-anzu
" 移動後にステータス情報をコマンドラインへと出力を行います。
" statusline を使用したくない場合はこっちを使用して下さい。
nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)


" shaberu.vim
" うるさい

"autocmd MyAutoCmd VimEnter * ShaberuSay 'Wellcome to VIM'
"autocmd MyAutoCmd VimLeave * ShaberuSay 'See you!'
"
"
"日付を書き出す
inoremap \date <C-r>=strftime("%Y-%m-%d")<CR><CR>

以上です