.vimrc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. "---------------------------------------------------------------------------
  2. " 検索の挙動に関する設定:
  3. "
  4. " 検索時に大文字小文字を無視 (noignorecase:無視しない)
  5. set ignorecase
  6. " 大文字小文字の両方が含まれている場合は大文字小文字を区別
  7. set smartcase
  8. "---------------------------------------------------------------------------
  9. " 編集に関する設定:
  10. "
  11. " タブの画面上での幅
  12. set tabstop=2
  13. " タブをスペースに展開しない (expandtab:展開する)
  14. set expandtab
  15. " 自動的にインデントする (noautoindent:インデントしない)
  16. set autoindent
  17. " バックスペースでインデントや改行を削除できるようにする
  18. set backspace=2
  19. " 検索時にファイルの最後まで行ったら最初に戻る (nowrapscan:戻らない)
  20. set wrapscan
  21. " 括弧入力時に対応する括弧を表示 (noshowmatch:表示しない)
  22. set showmatch
  23. " コマンドライン補完するときに強化されたものを使う(参照 :help wildmenu)
  24. set wildmenu
  25. " テキスト挿入中の自動折り返しを日本語に対応させる
  26. set formatoptions+=mM
  27. set softtabstop=2
  28. set shiftwidth=4
  29. "---------------------------------------------------------------------------
  30. " GUI固有ではない画面表示の設定:
  31. "
  32. " 行番号を非表示 (number:表示)
  33. "set nonumber
  34. " ルーラーを表示 (noruler:非表示)
  35. set ruler
  36. " タブや改行を表示 (list:表示)
  37. set nolist
  38. " どの文字でタブや改行を表示するかを設定
  39. "set listchars=tab:>-,extends:<,trail:-,eol:<
  40. " 長い行を折り返して表示 (nowrap:折り返さない)
  41. set wrap
  42. " 常にステータス行を表示 (詳細は:he laststatus)
  43. set laststatus=2
  44. " コマンドラインの高さ (Windows用gvim使用時はgvimrcを編集すること)
  45. set cmdheight=2
  46. " コマンドをステータス行に表示
  47. set showcmd
  48. " タイトルを表示
  49. set title
  50. " 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる)
  51. "colorscheme evening " (Windows用gvim使用時はgvimrcを編集すること)
  52. "シンタックスハイライトを有効にする
  53. syntax on
  54. "---------------------------------------------------------------------------
  55. " ファイル操作に関する設定:
  56. "
  57. " バックアップファイルを作成しない (次行の先頭の " を削除すれば有効になる)
  58. "set nobackup
  59. "---------------------------------------------------------------------------
  60. " ファイル名に大文字小文字の区別がないシステム用の設定:
  61. " (例: DOS/Windows/MacOS)
  62. "
  63. if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC')
  64. " tagsファイルの重複防止
  65. set tags=./tags,tags
  66. endif
  67. "---------------------------------------------------------------------------
  68. " コンソールでのカラー表示のための設定(暫定的にUNIX専用)
  69. if has('unix') && !has('gui_running')
  70. let uname = system('uname')
  71. if uname =~? "linux"
  72. set term=builtin_linux
  73. elseif uname =~? "freebsd"
  74. set term=builtin_cons25
  75. elseif uname =~? "Darwin"
  76. set term=beos-ansi
  77. else
  78. set term=builtin_xterm
  79. endif
  80. unlet uname
  81. endif
  82. "---------------------------------------------------------------------------
  83. " コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応
  84. if !has('gui_running') && has('xterm_clipboard')
  85. set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen
  86. endif
  87. " タブページの切り替えをWindowsのように
  88. " CTRL+Tab SHIFT+Tabで行うように.
  89. "
  90. if v:version >= 700
  91. nnoremap <C-Tab> gt
  92. nnoremap <C-S-Tab> gT
  93. endif
  94. set nocompatible
  95. filetype off
  96. if has('vim_starting')
  97. set runtimepath+=~/.vim/neobundle.vim.git
  98. call neobundle#rc(expand('~/.bundle'))
  99. endif
  100. NeoBundle 'gmarik/vundle'
  101. "NeoBundle 'git://github.com/Shougo/clang_complete.git'
  102. NeoBundle 'git://github.com/Shougo/echodoc.git'
  103. NeoBundle 'git://github.com/Shougo/neocomplcache.git'
  104. NeoBundle 'git://github.com/Shougo/neobundle.vim.git'
  105. NeoBundle 'git://github.com/Shougo/unite.vim.git'
  106. "NeoBundle 'git://github.com/Shougo/vim-vcs.git'
  107. NeoBundle 'git://github.com/Shougo/vimfiler.git'
  108. NeoBundle 'git://github.com/Shougo/vimshell.git'
  109. "NeoBundle 'git://github.com/Shougo/vinarise.git'
  110. NeoBundle 'Shougo/vimproc'
  111. NeoBundle 'thinca/vim-quickrun'
  112. NeoBundle 'tsukkee/lingr-vim'
  113. NeoBundle 'Shougo/neocomplcache-snippets-complete'
  114. NeoBundle 'browser.vim'
  115. NeoBundle 'synmark.vim'
  116. NeoBundle 'tyru/open-browser.vim'
  117. NeoBundle 'mattn/gist-vim'
  118. NeoBundle 'mattn/webapi-vim'
  119. NeoBundle 'mru.vim'
  120. NeoBundle 'jondistad/vimclojure'
  121. NeoBundle 'ujihisa/neco-ghc'
  122. filetype plugin on
  123. filetype indent on
  124. set ww+=h,l,>,<,[,]
  125. set number
  126. set mouse=a
  127. set ttymouse=xterm2
  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. let g:neocomplcache_enable_at_startup = 1
  139. let g:netrw_nogx = 1 " disable netrw's gx mapping.
  140. nmap gx <Plug>(openbrowser-smart-search)
  141. vmap gx <Plug>(openbrowser-smart-search)
  142. if has('win32') || has('win64')
  143. let g:quickrun_config = { }
  144. let g:quickrun_config['cs'] = {
  145. \ 'command' : 'c:/Windows/Microsoft.NET/Framework/v4.0.30319/csc.exe',
  146. \ 'runmode' : 'simple',
  147. \ 'exec' : ['%c /nologo %s:gs?/?\\? > /dev/null', '"%S:p:r:gs?/?\\?.exe" %a', ':call delete("%S:p:r.exe")'],
  148. \ 'tempfile' : '{tempname()}.cs',
  149. \ }
  150. endif
  151. augroup plugin-lingr-vim
  152. autocmd!
  153. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  154. augroup END
  155. "augroup vimrc-plugin-lingr
  156. " autocmd!
  157. " autocmd User plugin-lingr-* call s:lingr_event(
  158. " \ matchstr(expand('<amatch>'), 'plugin-lingr-\zs\w*'))
  159. "augroup END
  160. "function! s:lingr_event(event)
  161. " if a:event ==# 'message' && exists(':WindowName') == 2
  162. " execute printf('WindowName %s(%d)', 'lingr-vim', lingr#unread_count())
  163. " endif
  164. "endfunction
  165. "
  166. "function! s:set_window_name(name)
  167. " let esc = "\<ESC>"
  168. " silent! execute '!echo -n "' . esc . 'k' . escape(a:name, '%#!')
  169. " \ . esc . '\\"'
  170. " redraw!
  171. "endfunction
  172. "command! -nargs=? WindowName call s:set_window_name(<q-args>)
  173. augroup vimrc
  174. autocmd!
  175. augroup END
  176. function! s:SID_PREFIX()
  177. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  178. endfunction
  179. set titlelen=100
  180. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  181. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  182. if exists('$TMUX') || exists('$WINDOW')
  183. set t_ts=k
  184. set t_fs=\
  185. endif
  186. function! s:titlestring()
  187. if &filetype =~ '^lingr'
  188. let &titlestring = 'vim: [lingr: ' . lingr#unread_count() . ']'
  189. else
  190. let &titlestring = 'vim: %<' . bufname('')
  191. endif
  192. endfunction
  193. " tabline
  194. set showtabline=2 " always show tabline
  195. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  196. function! s:tabline()
  197. " show each tab
  198. let s = ''
  199. for i in range(1, tabpagenr('$'))
  200. let list = tabpagebuflist(i)
  201. let nr = tabpagewinnr(i)
  202. let current_tabnr = tabpagenr()
  203. if i == current_tabnr
  204. let title = fnamemodify(getcwd(), ':t') . '/'
  205. else
  206. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  207. endif
  208. let title = empty(title) ? '[No Name]' : title
  209. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  210. let s .= '%' . i . 'T[' . i . '] ' . title
  211. let s .= ' '
  212. endfor
  213. " show lingr unread count
  214. let lingr_unread = ""
  215. if exists('*lingr#unread_count')
  216. let lingr_unread_count = lingr#unread_count()
  217. if lingr_unread_count > 0
  218. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  219. elseif lingr_unread_count == 0
  220. let lingr_unread = "()"
  221. endif
  222. endif
  223. " build tabline
  224. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  225. return s
  226. endfunction
  227. "set guitablabel = %{s:titlestring()}
  228. let g:github_user = 'raa0121'
  229. let g:github_token = 'e3ded9cf6669cc31dbca'
  230. let g:clj_highlight_builtins = 1
  231. let g:clj_paren_rainbow = 1