.vimrc 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. NeoBundleLazy 'thinca/vim-ft-clojure',{'autoload' : {'filetypes' : ['clj']}}
  105. NeoBundleLazy 'ujihisa/neco-ghc',{'autoload' : {'filetypes' : ['hs']}}
  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. NeoBundleLazy 'dag/vim2hs',{'autoload' : {'filetypes' : ['hs']}}
  114. NeoBundleLazy 'eagletmt/ghcmod-vim', {'autoload' : {'filetypes' : ['hs']}}
  115. NeoBundleLazy 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex', {
  116. \ 'autoload' : {'filetypes' : ['tex', 'sty']}}
  117. NeoBundle 'thinca/vim-singleton'
  118. NeoBundle 'mattn/benchvimrc-vim'
  119. NeoBundle 'ryutorion/vim-itunes'
  120. filetype plugin indent on
  121. if has('clientserver')
  122. call singleton#enable()
  123. end
  124. set ww+=h,l,>,<,[,]
  125. set mouse=a
  126. set ttymouse=xterm2
  127. set clipboard+=unnamed
  128. " ,is: シェルを起動
  129. nnoremap <silent> ,is :VimShell<CR>
  130. " ,ipy: pythonを非同期で起動
  131. nnoremap <silent> ,ipy :VimShellInteractive python<CR>
  132. " ,irb: irbを非同期で起動
  133. nnoremap <silent> ,irb :VimShellInteractive irb<CR>
  134. " ,ss: 非同期で開いたインタプリタに現在の行を評価させる
  135. vmap <silent> ,ss :VimShellSendString<CR>
  136. " 選択中に,ss: 非同期で開いたインタプリタに選択行を評価させる
  137. nnoremap <silent> ,ss <S-v>:VimShellSendString<CR>
  138. " Disable AutoComplPop. Comment out this line if AutoComplPop is not
  139. " installed.
  140. let g:acp_enableAtStartup = 0
  141. " " Launches neocomplcache automatically on vim startup.
  142. let g:neocomplcache_enable_at_startup = 1
  143. " " Use smartcase.
  144. let g:neocomplcache_enable_smart_case = 1
  145. " " Use camel case completion.
  146. let g:neocomplcache_enable_camel_case_completion = 1
  147. " " Use underscore completion.
  148. let g:neocomplcache_enable_underbar_completion = 1
  149. " " Sets minimum char length of syntax keyword.
  150. let g:neocomplcache_min_syntax_length = 3
  151. let g:vimfiler_as_default_explorer = 1
  152. "tabで補完候補の選択を行う
  153. inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
  154. inoremap <expr><S-TAB> pumvisible() ? "\<Up>" : "\<S-TAB>"
  155. let g:netrw_nogx = 1
  156. nmap gx <Plug>(openbrowser-smart-search)
  157. vmap gx <Plug>(openbrowser-smart-search)
  158. augroup plugin-lingr-vim
  159. autocmd!
  160. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  161. autocmd FileType lingr-say let &syntax='clojure'
  162. augroup END
  163. augroup vimrc
  164. autocmd!
  165. augroup END
  166. function! s:SID_PREFIX()
  167. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  168. endfunction
  169. set titlelen=100
  170. set guioptions-=e
  171. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  172. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  173. if exists('$TMUX') || exists('$WINDOW')
  174. set t_ts=k
  175. set t_fs=\
  176. endif
  177. function! s:titlestring()
  178. if &filetype =~ '^lingr'
  179. let &titlestring = 'lingr: ' . lingr#unread_count()
  180. else
  181. let &titlestring = bufname('')
  182. endif
  183. endfunction
  184. " tabline
  185. set showtabline=2 " always show tabline
  186. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  187. function! s:tabline()
  188. " show each tab
  189. let s = ''
  190. for i in range(1, tabpagenr('$'))
  191. let list = tabpagebuflist(i)
  192. let nr = tabpagewinnr(i)
  193. let current_tabnr = tabpagenr()
  194. "let title = bufname('')
  195. if i == current_tabnr
  196. let title = fnamemodify(getcwd(), ':t') . '/'
  197. "let title = bufname('')
  198. else
  199. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  200. endif
  201. let title = empty(title) ? '[No Name]' : title
  202. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  203. let s .= '%' . i . 'T[' . i . '] ' . title
  204. let s .= ' '
  205. endfor
  206. " show lingr unread count
  207. let lingr_unread = ""
  208. if exists('*lingr#unread_count')
  209. let lingr_unread_count = lingr#unread_count()
  210. if lingr_unread_count > 0
  211. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  212. elseif lingr_unread_count == 0
  213. let lingr_unread = "()"
  214. endif
  215. endif
  216. " build tabline
  217. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  218. return s
  219. endfunction
  220. let g:github_user = 'raa0121'
  221. let g:github_token = 'e3ded9cf6669cc31dbca'
  222. if s:has_plugin('eskk.vim')
  223. let g:eskk#directory = "~/.eskk"
  224. let g:eskk#dictionary = { 'path': "~/.skk-jisyo", 'sorted': 0, 'encoding': 'utf-8', }
  225. let g:eskk#large_dictionary = { 'path': "~/.eskk/SKK-JISYO.L", 'sorted': 1, 'encoding': 'euc-jp', }
  226. let g:eskk#enable_completion = 1
  227. endif
  228. if s:has_plugin('vim-latex')
  229. set shellslash
  230. set grepprg=grep\ -nH\ $*
  231. let g:tex_flavor='tex'
  232. let g:Tex_CompileRule_div = 'platex --interaction=nonstopmode $*'
  233. let g:Tex_BibtexFlavor = 'jbibtex'
  234. let g:Tex_ViewRule_dvi = '/cygdrive/c/texlive/2012/bin/win32/dviout.exe'
  235. let g:Tex_FormatDependency_pdf = 'dvi,pdf'
  236. let g:Tex_CompileRule_pdf = 'dvipdfmx $*.dvi'
  237. let g:Tex_ViewRule_pdf = '/cygdrive/d/Program/SumatraPDF/SumatraPDF.exe'
  238. endif
  239. " set imdisable