runtime! debian.vim " Source a global configuration file if available if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif " Source local customize if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local endif "customed vim rc " referenced http://archiva.jp/web/tool/vimrc.html set nocompatible set tags=~/.tags set lcs=tab:>-,eol:- filetype off set runtimepath+=~/.bundle/neobundle.vim call neobundle#rc(expand('~/.bundle')) NeoBundle 'git://github.com/Shougo/neobundle.vim.git' NeoBundle 'git://github.com/Shougo/unite.vim.git' NeoBundle 'git://github.com/Shougo/neocomplcache.git' NeoBundle 'git://github.com/mattn/webapi-vim.git' NeoBundle 'git://github.com/mattn/twipass-vim.git' NeoBundle 'git://github.com/mattn/zencoding-vim.git' NeoBundle 'git://github.com/mattn/vimplenote-vim.git' NeoBundle 'git://github.com/tyru/open-browser.vim.git' NeoBundle 'git://github.com/vim-ruby/vim-ruby.git' NeoBundle 'git://github.com/tpope/vim-rails.git' NeoBundle 'git://github.com/thinca/vim-quickrun.git' NeoBundle 'git://github.com/Lokaltog/vim-powerline.git' NeoBundle 'git://github.com/glidenote/memolist.vim.git' NeoBundle 'git://github.com/h1mesuke/unite-outline.git' NeoBundle 'git://github.com/motemen/git-vim.git' NeoBundle 'git://github.com/ervandew/supertab.git' "NeoBundle 'git://github.com/kana/vim-tabpagecd.git' NeoBundle 'git://github.com/Lokaltog/vim-easymotion.git' NeoBundle 'git://github.com/tmhedberg/matchit.git' NeoBundle 'surround.vim' "NeoBundle 'matchit.vim' NeoBundle 'ruby-matchit' NeoBundle 'srcexpl.vim' NeoBundle 'trinity.vim' NeoBundle 'NERD_tree.vim' NeoBundle 'taglist.vim' NeoBundle 'Javascript-syntax' NeoBundle 'TwitVim' NeoBundle 'sudo.vim' filetype plugin on filetype indent on " display " ---------------------- set number set ruler set scrolloff=7 set cmdheight=1 set laststatus=2 set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P set title set linespace=0 set wildmenu set wildmode=list:longest set showcmd set list set lcs=tab:>- " ウィンドウサイズの自動調整 set ambiwidth=double "set textwidth=78 "set columns=100 "set lines=150 " " for Japanese in gvim set noimdisable set noimcmdline set iminsert=1 set imsearch=1 " view " --------------------- set showcmd set showmode set cursorline " syntax color " --------------------- set t_Co=256 syntax on colorscheme torte highlight LineNr ctermfg=darkgray highlight CursorLine ctermbg=darkblue " search " ---------------------- set ignorecase set smartcase set wrapscan set hlsearch " edit " --------------------- set autoindent set showmatch set backspace=indent,eol,start set clipboard+=unnamed,autoselect set guioptions+=a set pastetoggle= set mouse=a set ttymouse=xterm2 " tab " -------------------- set tabstop=2 set expandtab set smarttab set shiftwidth=2 set shiftround "set nowrap " backup " -------------------- set backup set backupdir=~/vim_backup set swapfile set directory=~/vim_swap " keymaps " -------------------- " paste clipboad in insert mode imap "*pa " copy to clipboard in ubuntu vnoremap y "+y nnoremap yy "+yy " type command easily nnoremap . :edit $MYVIMRC nnoremap r :source $MYVIMRC nnoremap w :write nnoremap q :quit nnoremap Q :quit! nnoremap h :help nnoremap n :new nnoremap v :vnew " insert time nnoremap t :r!date"+\%H:\%M" " http://vim-users.jp/2009/09/hack74/ " Set augroup. augroup MyAutoCmd autocmd! augroup END if !has('gui_running') && !(has('win32') || has('win64')) " .vimrcの再読込時にも色が変化するようにする autocmd MyAutoCmd BufWritePost $MYVIMRC nested source $MYVIMRC else " .vimrcの再読込時にも色が変化するようにする autocmd MyAutoCmd BufWritePost $MYVIMRC source $MYVIMRC | \if has('gui_running') | source $MYGVIMRC autocmd MyAutoCmd BufWritePost $MYGVIMRC if has('gui_running') | source $MYGVIMRC endif " insert time nnoremap t :r!date"+\%H:\%M" " tab motion nnoremap :tabnext nnoremap :tabprevious nnoremap :tabnew " 行単位での移動 nnoremap j gj nnoremap k gk vnoremap j gj vnoremap k gk " Setting for Unite.vim " let g:unite_enable_start_insert=1 " バッファ一覧 nnoremap ;ub :Unite buffer " ファイル一覧 nnoremap ;uf :UniteWithBufferDir -buffer-name=files file " レジスタ一覧 nnoremap ;ur :Unite -buffer-name=register register " 最近使用したファイル一覧 nnoremap ;um :Unite file_mru " 常用セット nnoremap ;uu :Unite buffer file_mru " unite outline nnoremap ;uo :Unite outline " 全部乗せ nnoremap ;ua :UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file outline au FileType unite nnoremap q au FileType unite inoremap q " コマンドモードでよくやるやつ cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap " 挿入モードでの移動 inoremap inoremap inoremap inoremap " window操作 nnoremap wh h nnoremap wj j nnoremap wk k nnoremap wl l " 括弧の中身選択 vnoremap ( t( vnoremap ) t) vnoremap ] t] vnoremap [ t[ onoremap ( t( onoremap ) t) onoremap ] t] onoremap [ t[ " rubyのメソッドやクラスをまとめて選択する(b:block用、m:def用、c:class用、M:module用) nnoremap vab 0/end%Vn nnoremap vib 0/end%kVnj nnoremap vam $?\%(.*#.*def\)\@!def%Vn nnoremap vim $?\%(.*#.*def\)\@!def%kVnj nnoremap vac $?\%(.*#.*class\)\@!class%Vn nnoremap vic $?\%(.*#.*class\)\@!class%kVnj nnoremap vaM $?\%(.*#.*module\)\@!module%Vn nnoremap viM $?\%(.*#.*module\)\@!module%kVnj " タブに番号付ける " http://doruby.kbmj.com/aisi/20091218/Vim__ function! GuiTabLabel() let l:label = '' let l:bufnrlist = tabpagebuflist(v:lnum) let l:bufname = fnamemodify(bufname(l:bufnrlist[tabpagewinnr(v:lnum) - 1]), ':t') let l:label .= l:bufname == '' ? 'No title' : l:bufname let l:wincount = tabpagewinnr(v:lnum, '$') if l:wincount > 1 let l:label .= '[' . l:wincount . ']' endif for bufnr in l:bufnrlist if getbufvar(bufnr, "&modified") let l:label .= '[+]' break endif endfor return l:label endfunction set guitablabel=%N:\ %{GuiTabLabel()} " tabのディレクトリ管理をタブ単位で行う " http://labs.timedia.co.jp/2012/05/vim-tabpagecd.html augroup plugin-tabpagecd autocmd! autocmd TabEnter * \ if exists('t:cwd') \ | cd `=fnameescape(t:cwd)` \ | endif autocmd TabLeave * \ let t:cwd = getcwd() augroup END " htmlサンショウモに autocmd BufEnter * if &filetype == "html" | call MapHTMLKeys() | endif function! MapHTMLKeys(...) if a:0 == 0 || a:1 != 0 inoremap \\ \ inoremap \& & inoremap \< < inoremap \> > inoremap \. ・ inoremap \- — inoremap \   inoremap \` ‘ inoremap \' ’ inoremap \2 “ inoremap \" ” autocmd! BufLeave * call MapHTMLKeys(0) else iunmap \\ iunmap \& iunmap \< iunmap \> iunmap \- iunmap \ iunmap \` iunmap \' iunmap \2 iunmap \" autocmd! BufLeave * endif " test for mapping/unmapping endfunction " MapHTMLKeys() " Setting for hatena-vim " ------------------------------------------- set runtimepath+=$HOME/work/hatena let g:hatena_user='shim0mura' au BufRead,BufNewFile *.htn set filetype=hatena " Setting for vim-powerline " ------------------------------------------- let g:Powerline_symbols = 'fancy' set t_Co=256 " Setting for memolist.vim " ------------------------------------------- let g:memolist_path = "~/work/memo" nnoremap ;ml :MemoList nnoremap ;mn :MemoNew nnoremap ;mg :MemoGrep " Setting for surround.vim " ------------------------------------------- "surroundに定義を追加する【ASCIIコードを調べるには:echo char2nr("-")】 " '!' | '-' -> html comment let g:surround_33 = "" let g:surround_45 = "" " '%' -> erb section let g:surround_37 = "<% \r %>" " '#' -> 変数展開 let g:surround_35 = "#{\r}" " Setting for NERDTree " ------------------------------------------- " うごかん... let file_name = expand("%:p") if has('vim_starting') && file_name == "" autocmd VimEnter :NERDTree ./ endif " Setting for neocomplcache " ------------------------------------------- " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Use camel case completion. let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. let g:neocomplcache_enable_underbar_completion = 1 " Setting for openbrowser " ------------------------------------------- nmap gx (openbrowser-smart-search) vmap gx (openbrowser-smart-search) " Setting for easymotion " ------------------------------------------- " ホームポジションに近いキーを使う let g:EasyMotion_keys = 'hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB' let g:EasyMotion_leader_key = '' let g:EasyMotion_grouping = 1 hi EasyMotionTarget ctermbg = none ctermfg = red hi EasyMotionShade ctermbg = none ctermfg = blue " Setting for vimplenote " ------------------------------------------- nnoremap ;sl :VimpleNote -l nnoremap ;su :VimpleNote -u nnoremap ;sn :VimpleNote -n " command memo " ファイルを指定の文字コードで開き直す " :e ++enc=utf-8 " "