.vimrc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. " coding:utf-8
  2. " 検索時に大文字小文字を無視 (noignorecase:無視しない)
  3. set ignorecase
  4. " 大文字小文字の両方が含まれている場合は大文字小文字を区別
  5. set smartcase
  6. " タブの画面上での幅
  7. set tabstop=2
  8. " タブをスペースに展開しない (expandtab:展開する)
  9. set expandtab
  10. " 自動的にインデントする (noautoindent:インデントしない)
  11. set autoindent
  12. " バックスペースでインデントや改行を削除できるようにする
  13. set backspace=2
  14. " 検索時にファイルの最後まで行ったら最初に戻る (nowrapscan:戻らない)
  15. set wrapscan
  16. " 括弧入力時に対応する括弧を表示 (noshowmatch:表示しない)
  17. set showmatch
  18. " コマンドライン補完するときに強化されたものを使う(参照 :help wildmenu)
  19. set wildmenu
  20. " テキスト挿入中の自動折り返しを日本語に対応させる
  21. set formatoptions+=mM
  22. set softtabstop=2
  23. set shiftwidth=4
  24. set fileencodings=utf-8,cp932,euc-jp,default,latin
  25. " 行番号を非表示 (number:表示)
  26. set number
  27. " ルーラーを表示 (noruler:非表示)
  28. set ruler
  29. " タブや改行を表示 (list:表示)
  30. set nolist
  31. " 長い行を折り返して表示 (nowrap:折り返さない)
  32. set wrap
  33. " 常にステータス行を表示 (詳細は:he laststatus)
  34. set laststatus=2
  35. " コマンドラインの高さ (Windows用gvim使用時はgvimrcを編集すること)
  36. set cmdheight=2
  37. " コマンドをステータス行に表示
  38. set showcmd
  39. " タイトルを表示
  40. set title
  41. "シンタックスハイライトを有効にする
  42. syntax on
  43. " ファイル名に大文字小文字の区別がないシステム用の設定:
  44. " (例: DOS/Windows/MacOS)
  45. "
  46. if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC')
  47. " tagsファイルの重複防止
  48. set tags=./tags,tags
  49. endif
  50. " コンソールでのカラー表示のための設定(暫定的にUNIX専用)
  51. if has('unix') && !has('gui_running')
  52. let uname = system('uname')
  53. if uname =~? "linux"
  54. set term=builtin_linux
  55. elseif uname =~? "freebsd"
  56. set term=builtin_cons25
  57. elseif uname =~? "Darwin"
  58. set term=beos-ansi
  59. else
  60. set term=builtin_xterm
  61. endif
  62. unlet uname
  63. endif
  64. " コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応
  65. if !has('gui_running') && has('xterm_clipboard')
  66. set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen
  67. endif
  68. " タブページの切り替えをWindowsのように
  69. " CTRL+Tab SHIFT+Tabで行うように.
  70. if v:version >= 700
  71. nnoremap <C-Tab> gt
  72. nnoremap <C-S-Tab> gT
  73. endif
  74. function! s:has_plugin(...)
  75. return len(filter(copy(a:000), 'index(s:plugins, v:val) >= 0')) == len(a:000)
  76. endfunction
  77. set nocompatible
  78. filetype off
  79. if has('vim_starting')
  80. set runtimepath+=~/.vim/neobundle.vim.git
  81. call neobundle#rc(expand('~/.bundle'))
  82. endif
  83. NeoBundle 'Shougo/echodoc.git'
  84. NeoBundle 'Shougo/neocomplcache.git'
  85. NeoBundle 'Shougo/neobundle.vim.git'
  86. NeoBundle 'Shougo/unite.vim.git'
  87. NeoBundle 'Shougo/vimfiler.git'
  88. NeoBundle 'Shougo/vimshell.git'
  89. NeoBundle 'Shougo/vimproc'
  90. NeoBundle 'thinca/vim-quickrun'
  91. NeoBundle 'tsukkee/lingr-vim'
  92. NeoBundle 'Shougo/neosnippet'
  93. NeoBundle 'browser.vim'
  94. NeoBundle 'synmark.vim'
  95. NeoBundle 'tyru/open-browser.vim'
  96. NeoBundle 'mattn/gist-vim'
  97. NeoBundle 'mattn/webapi-vim'
  98. NeoBundle 'mru.vim'
  99. NeoBundle 'thinca/vim-ft-clojure'
  100. NeoBundle 'ujihisa/neco-ghc'
  101. NeoBundle 'sudo.vim'
  102. NeoBundle 'ujihisa/vimshell-ssh'
  103. NeoBundle 'Shougo/unite-ssh'
  104. "NeoBundle 'tyru/skkdict.vim'
  105. "NeoBundle 'tyru/eskk.vim'
  106. NeoBundle 'ujihisa/neco-look'
  107. NeoBundle 'vim-jp/vital.vim'
  108. NeoBundle 'dag/vim2hs'
  109. NeoBundle 'eagletmt/ghcmod-vim'
  110. NeoBundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex'
  111. filetype plugin indent on
  112. set ww+=h,l,>,<,[,]
  113. set mouse=a
  114. set ttymouse=xterm2
  115. set clipboard+=unnamed
  116. if s:has_plugin('VimShell')
  117. " ,is: シェルを起動
  118. nnoremap <silent> ,is :VimShell<CR>
  119. " ,ipy: pythonを非同期で起動
  120. nnoremap <silent> ,ipy :VimShellInteractive python<CR>
  121. " ,irb: irbを非同期で起動
  122. nnoremap <silent> ,irb :VimShellInteractive irb<CR>
  123. " ,ss: 非同期で開いたインタプリタに現在の行を評価させる
  124. vmap <silent> ,ss :VimShellSendString<CR>
  125. " 選択中に,ss: 非同期で開いたインタプリタに選択行を評価させる
  126. nnoremap <silent> ,ss <S-v>:VimShellSendString<CR>
  127. endif
  128. if s:has_plugin('neocomplcache')
  129. let g:neocomplcache_enable_at_startup = 1
  130. "tabで補完候補の選択を行う
  131. inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
  132. inoremap <expr><S-TAB> pumvisible() ? "\<Up>" : "\<S-TAB>"
  133. endif
  134. let g:netrw_nogx = 1 " disable netrw's gx mapping.
  135. nmap gx <Plug>(openbrowser-smart-search)
  136. vmap gx <Plug>(openbrowser-smart-search)
  137. augroup plugin-lingr-vim
  138. autocmd!
  139. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  140. autocmd FileType lingr-say let &syntax='clojure'
  141. augroup END
  142. augroup vimrc
  143. autocmd!
  144. augroup END
  145. function! s:SID_PREFIX()
  146. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  147. endfunction
  148. set titlelen=100
  149. set guioptions-=e
  150. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  151. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  152. if exists('$TMUX') || exists('$WINDOW')
  153. set t_ts=k
  154. set t_fs=\
  155. endif
  156. function! s:titlestring()
  157. if &filetype =~ '^lingr'
  158. let &titlestring = 'lingr: ' . lingr#unread_count()
  159. else
  160. let &titlestring = bufname('')
  161. endif
  162. endfunction
  163. " tabline
  164. set showtabline=2 " always show tabline
  165. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  166. function! s:tabline()
  167. " show each tab
  168. let s = ''
  169. for i in range(1, tabpagenr('$'))
  170. let list = tabpagebuflist(i)
  171. let nr = tabpagewinnr(i)
  172. let current_tabnr = tabpagenr()
  173. "let title = bufname('')
  174. if i == current_tabnr
  175. let title = fnamemodify(getcwd(), ':t') . '/'
  176. "let title = bufname('')
  177. else
  178. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  179. endif
  180. let title = empty(title) ? '[No Name]' : title
  181. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  182. let s .= '%' . i . 'T[' . i . '] ' . title
  183. let s .= ' '
  184. endfor
  185. " show lingr unread count
  186. let lingr_unread = ""
  187. if exists('*lingr#unread_count')
  188. let lingr_unread_count = lingr#unread_count()
  189. if lingr_unread_count > 0
  190. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  191. elseif lingr_unread_count == 0
  192. let lingr_unread = "()"
  193. endif
  194. endif
  195. " build tabline
  196. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  197. return s
  198. endfunction
  199. let g:github_user = 'raa0121'
  200. let g:github_token = 'e3ded9cf6669cc31dbca'
  201. if s:has_plugin('eskk.vim')
  202. let g:eskk#directory = "~/.eskk"
  203. let g:eskk#dictionary = { 'path': "~/.skk-jisyo", 'sorted': 0, 'encoding': 'utf-8', }
  204. let g:eskk#large_dictionary = { 'path': "~/.eskk/SKK-JISYO.L", 'sorted': 1, 'encoding': 'euc-jp', }
  205. let g:eskk#enable_completion = 1
  206. endif
  207. " latex
  208. set shellslash
  209. set grepprg=grep\ -nH\ $*
  210. let g:tex_flavor='tex'
  211. let g:Tex_CompileRule_div = 'platex --interaction=nonstopmode $*'
  212. let g:Tex_BibtexFlavor = 'jbibtex'
  213. let g:Tex_ViewRule_dvi = '/cygdrive/c/texlive/2012/bin/win32/dviout.exe'
  214. let g:Tex_FormatDependency_pdf = 'dvi,pdf'
  215. let g:Tex_CompileRule_pdf = 'dvipdfmx $*.dvi'
  216. let g:Tex_ViewRule_pdf = '/cygdrive/d/Program/SumatraPDF/SumatraPDF.exe'
  217. " set imdisable