.vimrc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. try
  75. let s:plugins = map(filter(neobundle#config#get_neobundles(), 'isdirectory(v:val.path) && neobundle#config#is_sourced(v:val.name)'), 'v:val.name')
  76. catch
  77. let s:plugins = []
  78. endtry
  79. function! s:has_plugin(...)
  80. return len(filter(copy(a:000), 'index(s:plugins, v:val) >= 0')) == len(a:000)
  81. endfunction
  82. set nocompatible
  83. filetype off
  84. if has('vim_starting')
  85. set runtimepath+=~/.vim/neobundle.vim.git
  86. call neobundle#rc(expand('~/.bundle'))
  87. endif
  88. NeoBundle 'Shougo/echodoc.git'
  89. NeoBundle 'Shougo/neocomplcache.git'
  90. NeoBundle 'Shougo/neobundle.vim.git'
  91. NeoBundle 'Shougo/unite.vim.git'
  92. NeoBundle 'Shougo/vimfiler.git'
  93. NeoBundle 'Shougo/vimshell.git'
  94. NeoBundle 'Shougo/vimproc'
  95. NeoBundle 'thinca/vim-quickrun'
  96. NeoBundle 'tsukkee/lingr-vim'
  97. NeoBundle 'Shougo/neosnippet'
  98. NeoBundle 'browser.vim'
  99. NeoBundle 'synmark.vim'
  100. NeoBundle 'tyru/open-browser.vim'
  101. NeoBundle 'mattn/gist-vim'
  102. NeoBundle 'mattn/webapi-vim'
  103. NeoBundle 'mru.vim'
  104. NeoBundle 'thinca/vim-ft-clojure'
  105. NeoBundle 'ujihisa/neco-ghc'
  106. NeoBundle 'sudo.vim'
  107. NeoBundle 'ujihisa/vimshell-ssh'
  108. NeoBundle 'Shougo/unite-ssh'
  109. "NeoBundle 'tyru/skkdict.vim'
  110. "NeoBundle 'tyru/eskk.vim'
  111. NeoBundle 'ujihisa/neco-look'
  112. NeoBundle 'vim-jp/vital.vim'
  113. NeoBundle 'dag/vim2hs'
  114. NeoBundle 'eagletmt/ghcmod-vim'
  115. NeoBundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex'
  116. filetype plugin indent on
  117. set ww+=h,l,>,<,[,]
  118. set mouse=a
  119. set ttymouse=xterm2
  120. set clipboard+=unnamed
  121. if s:has_plugin('VimShell')
  122. " ,is: シェルを起動
  123. nnoremap <silent> ,is :VimShell<CR>
  124. " ,ipy: pythonを非同期で起動
  125. nnoremap <silent> ,ipy :VimShellInteractive python<CR>
  126. " ,irb: irbを非同期で起動
  127. nnoremap <silent> ,irb :VimShellInteractive irb<CR>
  128. " ,ss: 非同期で開いたインタプリタに現在の行を評価させる
  129. vmap <silent> ,ss :VimShellSendString<CR>
  130. " 選択中に,ss: 非同期で開いたインタプリタに選択行を評価させる
  131. nnoremap <silent> ,ss <S-v>:VimShellSendString<CR>
  132. endif
  133. if s:has_plugin('neocomplcache')
  134. let g:neocomplcache_enable_at_startup = 1
  135. "tabで補完候補の選択を行う
  136. inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
  137. inoremap <expr><S-TAB> pumvisible() ? "\<Up>" : "\<S-TAB>"
  138. endif
  139. if s:has_plugin('openbrower.vim')
  140. nmap gx <Plug>(openbrowser-smart-search)
  141. vmap gx <Plug>(openbrowser-smart-search)
  142. endif
  143. augroup plugin-lingr-vim
  144. autocmd!
  145. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  146. autocmd FileType lingr-say let &syntax='clojure'
  147. augroup END
  148. augroup vimrc
  149. autocmd!
  150. augroup END
  151. function! s:SID_PREFIX()
  152. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  153. endfunction
  154. set titlelen=100
  155. set guioptions-=e
  156. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  157. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  158. if exists('$TMUX') || exists('$WINDOW')
  159. set t_ts=k
  160. set t_fs=\
  161. endif
  162. function! s:titlestring()
  163. if &filetype =~ '^lingr'
  164. let &titlestring = 'lingr: ' . lingr#unread_count()
  165. else
  166. let &titlestring = bufname('')
  167. endif
  168. endfunction
  169. " tabline
  170. set showtabline=2 " always show tabline
  171. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  172. function! s:tabline()
  173. " show each tab
  174. let s = ''
  175. for i in range(1, tabpagenr('$'))
  176. let list = tabpagebuflist(i)
  177. let nr = tabpagewinnr(i)
  178. let current_tabnr = tabpagenr()
  179. "let title = bufname('')
  180. if i == current_tabnr
  181. let title = fnamemodify(getcwd(), ':t') . '/'
  182. "let title = bufname('')
  183. else
  184. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  185. endif
  186. let title = empty(title) ? '[No Name]' : title
  187. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  188. let s .= '%' . i . 'T[' . i . '] ' . title
  189. let s .= ' '
  190. endfor
  191. " show lingr unread count
  192. let lingr_unread = ""
  193. if exists('*lingr#unread_count')
  194. let lingr_unread_count = lingr#unread_count()
  195. if lingr_unread_count > 0
  196. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  197. elseif lingr_unread_count == 0
  198. let lingr_unread = "()"
  199. endif
  200. endif
  201. " build tabline
  202. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  203. return s
  204. endfunction
  205. let g:github_user = 'raa0121'
  206. let g:github_token = 'e3ded9cf6669cc31dbca'
  207. if s:has_plugin('eskk.vim')
  208. let g:eskk#directory = "~/.eskk"
  209. let g:eskk#dictionary = { 'path': "~/.skk-jisyo", 'sorted': 0, 'encoding': 'utf-8', }
  210. let g:eskk#large_dictionary = { 'path': "~/.eskk/SKK-JISYO.L", 'sorted': 1, 'encoding': 'euc-jp', }
  211. let g:eskk#enable_completion = 1
  212. endif
  213. if s:has_plugin('vim-latex')
  214. set shellslash
  215. set grepprg=grep\ -nH\ $*
  216. let g:tex_flavor='tex'
  217. let g:Tex_CompileRule_div = 'platex --interaction=nonstopmode $*'
  218. let g:Tex_BibtexFlavor = 'jbibtex'
  219. let g:Tex_ViewRule_dvi = '/cygdrive/c/texlive/2012/bin/win32/dviout.exe'
  220. let g:Tex_FormatDependency_pdf = 'dvi,pdf'
  221. let g:Tex_CompileRule_pdf = 'dvipdfmx $*.dvi'
  222. let g:Tex_ViewRule_pdf = '/cygdrive/d/Program/SumatraPDF/SumatraPDF.exe'
  223. endif
  224. " set imdisable