.vimrc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. " coding:utf-8
  2. " ζ*'ヮ')ζ ζ(*'ヮ'リ+
  3. "
  4. set ignorecase
  5. set smartcase
  6. set tabstop=2
  7. set expandtab
  8. set autoindent
  9. set backspace=2
  10. set wrapscan
  11. set showmatch
  12. set wildmenu
  13. set formatoptions+=mM
  14. set softtabstop=2
  15. set shiftwidth=4
  16. set fileencodings=utf-8,sjis,cp932,euc-jp,default,latin
  17. set number
  18. set ruler
  19. set nolist
  20. set wrap
  21. set laststatus=2
  22. set cmdheight=2
  23. set showcmd
  24. set title
  25. set hlsearch
  26. colorscheme evening
  27. syntax on
  28. " ファイル名に大文字小文字の区別がないシステム用の設定:
  29. " (例: DOS/Windows/MacOS)
  30. "
  31. if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC')
  32. " tagsファイルの重複防止
  33. set tags=./tags,tags
  34. endif
  35. " コンソールでのカラー表示のための設定(暫定的にUNIX専用)
  36. if has('unix') && !has('gui_running')
  37. let uname = system('uname')
  38. if uname =~? "linux"
  39. set term=builtin_linux
  40. elseif uname =~? "freebsd"
  41. set term=builtin_cons25
  42. elseif uname =~? "Darwin"
  43. set term=beos-ansi
  44. else
  45. set term=builtin_xterm
  46. endif
  47. unlet uname
  48. endif
  49. " コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応
  50. if !has('gui_running') && has('xterm_clipboard')
  51. set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen
  52. endif
  53. " タブページの切り替えをWindowsのように
  54. " CTRL+Tab SHIFT+Tabで行うように.
  55. if v:version >= 700
  56. nnoremap <C-Tab> gt
  57. nnoremap <C-S-Tab> gT
  58. endif
  59. if has('+regexpengine')
  60. set re=0
  61. endif
  62. set nocompatible
  63. filetype off
  64. if has('vim_starting')
  65. set runtimepath+=~/.vim/neobundle.vim.git
  66. endif
  67. call neobundle#rc(expand('~/.bundle'))
  68. let g:neobundle_default_git_protocol='git'
  69. NeoBundle 'thinca/vim-openbuf'
  70. NeoBundle 'jnwhiteh/vim-golang'
  71. NeoBundle 'osyo-manga/vim-snowdrop'
  72. NeoBundle 'Shougo/echodoc', '', 'default'
  73. call neobundle#config('echodoc', {
  74. \ 'lazy' : 1,
  75. \ 'autoload' : {
  76. \ 'insert' : 1,
  77. \ }})
  78. if has('lua')
  79. NeoBundle 'Shougo/neocomplete.vim', '', 'default'
  80. call neobundle#config('neocomplete.vim', {
  81. \ 'lazy' : 1,
  82. \ 'autoload' : {
  83. \ 'commands' : 'NeoComplateEnable'
  84. \ }})
  85. else
  86. NeoBundle 'Shougo/neocomplcache', '', 'default'
  87. call neobundle#config('neocomplcache', {
  88. \ 'lazy' : 1,
  89. \ 'autoload' : {
  90. \ 'commands' : 'NeoComplCacheEnable',
  91. \ }})
  92. endif
  93. "NeoBundle 'Shougo/neocomplcache-rsense', '', 'default'
  94. "call neobundle#config('neocomplcache-rsense', {
  95. " \ 'lazy' : 1,
  96. " \ 'depends' : 'Shougo/neocomplcache',
  97. " \ 'autoload' : { 'filetypes' : 'ruby' }
  98. " \ })
  99. NeoBundle 'Shougo/neobundle.vim'
  100. NeoBundle 'Shougo/unite.vim', '', 'default'
  101. call neobundle#config('unite.vim',{
  102. \ 'lazy' : 1,
  103. \ 'autoload' : {
  104. \ 'commands' : [{ 'name' : 'Unite',
  105. \ 'complete' : 'customlist,unite#complete_source'},
  106. \ 'UniteWithCursorWord', 'UniteWithInput']
  107. \ }})
  108. NeoBundle 'Shougo/vimfiler', '', 'default'
  109. call neobundle#config('vimfiler', {
  110. \ 'lazy' : 1,
  111. \ 'depends' : 'Shougo/unite.vim',
  112. \ 'autoload' : {
  113. \ 'commands' : [
  114. \ { 'name' : 'VimFiler',
  115. \ 'complete' : 'customlist,vimfiler#complete' },
  116. \ { 'name' : 'VimFilerExplorer',
  117. \ 'complete' : 'customlist,vimfiler#complete' },
  118. \ { 'name' : 'Edit',
  119. \ 'complete' : 'customlist,vimfiler#complete' },
  120. \ { 'name' : 'Write',
  121. \ 'complete' : 'customlist,vimfiler#complete' },
  122. \ 'Read', 'Source'],
  123. \ 'mappings' : ['<Plug>(vimfiler_switch)'],
  124. \ 'explorer' : 1,
  125. \ }
  126. \ })
  127. NeoBundle 'Shougo/vimshell', '', 'default'
  128. call neobundle#config('vimshell', {
  129. \ 'lazy' : 1,
  130. \ 'autoload' : {
  131. \ 'commands' : [{ 'name' : 'VimShell',
  132. \ 'complete' : 'customlist,vimshell#complete'},
  133. \ 'VimShellExecute', 'VimShellInteractive',
  134. \ 'VimShellTerminal', 'VimShellPop'],
  135. \ 'mappings' : ['<Plug>(vimshell_switch)']
  136. \ }})
  137. if has('win32')
  138. NeoBundleLocal 'C:\vim\plugin'
  139. else
  140. NeoBundle 'Shougo/vimproc', '', 'default'
  141. call neobundle#config('vimproc', {
  142. \ 'build' : {
  143. \ 'windows' : 'make -f make_mingw32.mak',
  144. \ 'cygwin' : 'make -f make_cygwin.mak',
  145. \ 'mac' : 'make -f make_mac.mak',
  146. \ 'unix' : 'make -f make_unix.mak',
  147. \ },
  148. \ })
  149. endif
  150. NeoBundle 'thinca/vim-quickrun'
  151. call neobundle#config('vim-quickrun', {
  152. \ 'lazy' : 1,
  153. \ 'autoload' : {
  154. \ 'mappings' : [
  155. \ ['nxo', '<Plug>(quickrun)']],
  156. \ 'commands' : 'QuickRun',
  157. \ },
  158. \ })
  159. NeoBundle 'tsukkee/lingr-vim'
  160. call neobundle#config('lingr-vim', {
  161. \ 'lazy' : 1,
  162. \ 'autoload' : {
  163. \ 'commands' : 'LingrLaunch',
  164. \ },
  165. \ })
  166. NeoBundle 'Shougo/neosnippet', '', 'default'
  167. call neobundle#config('neosnippet', {
  168. \ 'lazy' : 1,
  169. \ 'autoload' : {
  170. \ 'insert' : 1,
  171. \ 'filetypes' : 'snippet',
  172. \ 'unite_sources' : ['snippet', 'neosnippet/user', 'neosnippet/runtime'],
  173. \ }})
  174. NeoBundle 'browser.vim'
  175. NeoBundle 'synmark.vim'
  176. NeoBundleLazy 'tyru/open-browser.vim', { 'autoload' : {
  177. \ 'mappings' : '<Plug>(open-browser-wwwsearch)',
  178. \ }}
  179. NeoBundle 'mattn/gist-vim'
  180. NeoBundle 'mattn/webapi-vim'
  181. NeoBundle 'mru.vim'
  182. NeoBundle 'thinca/vim-ft-clojure'
  183. NeoBundleLazy 'ujihisa/neco-ghc', { 'autoload' : {
  184. \ 'filetypes' : 'haskell',
  185. \ }}
  186. NeoBundle 'sudo.vim'
  187. NeoBundleLazy 'ujihisa/vimshell-ssh', { 'autoload' : {
  188. \ 'filetypes' : 'vimshell',
  189. \ }}
  190. NeoBundle 'Shougo/unite-ssh'
  191. NeoBundle 'ujihisa/neco-look'
  192. NeoBundle 'vim-jp/vital.vim', '', 'default'
  193. "call neobundle#config('vital.vim', {
  194. " \ 'lazy' : 1,
  195. " \ 'autoload' : {
  196. " \ 'commands' : ['Vitalize'],
  197. " \ }})
  198. NeoBundleLazy 'dag/vim2hs', { 'autoload' : {
  199. \ 'filetypes' : 'haskell',
  200. \ }}
  201. NeoBundleLazy 'eagletmt/ghcmod-vim', { 'autoload' : {
  202. \ 'filetypes' : 'haskell',
  203. \ }}
  204. NeoBundle 'thinca/vim-ref'
  205. NeoBundle 'thinca/vim-singleton'
  206. NeoBundle 'mattn/benchvimrc-vim'
  207. NeoBundle 'ryutorion/vim-itunes'
  208. NeoBundle 'raa0121/vim-ulilith'
  209. NeoBundle 'mattn/libcallex-vim'
  210. NeoBundle 'thinca/vim-splash'
  211. NeoBundle 'mattn/sonictemplate-vim'
  212. NeoBundle 'raa0121/vim-eclim'
  213. NeoBundle 'thinca/vim-github'
  214. NeoBundle 'nosami/Omnisharp'
  215. NeoBundle 'jceb/vim-orgmode'
  216. "NeoBundle 'Lokaltog/powerline', { 'rtp' : 'powerline/bindings/vim'}
  217. "NeoBundle 'taichouchou2/alpaca_powertabline'
  218. "NeoBundle 'zhaocai/linepower.vim'
  219. NeoBundle 'osyo-manga/quickrun-hook-u-nya-'
  220. NeoBundle 'osyo-manga/unite-quickfix'
  221. NeoBundle 'basyura/J6uil.vim', '', 'default'
  222. call neobundle#config('J6uil.vim', {
  223. \ 'lazy' : 1,
  224. \ 'autoload' : {
  225. \ 'commands' : 'J6uil',
  226. \ },
  227. \ 'depends' : 'mattn/webapi-vim',
  228. \ })
  229. NeoBundle 'mattn/unite-rhythmbox'
  230. NeoBundleLazy 'rbtnn/vimconsole.vim', {
  231. \ 'depends' : 'thinca/vim-prettyprint',
  232. \ 'autoload' : {
  233. \ 'commands' : 'VimConsoleOpen'
  234. \ }}
  235. filetype plugin indent on
  236. if has('clientserver')
  237. call singleton#enable()
  238. end
  239. set ww+=h,l,>,<,[,]
  240. set mouse=a
  241. set ttymouse=xterm2
  242. set clipboard=unnamedplus
  243. " ,is: シェルを起動
  244. nnoremap <silent> ,is :VimShell<CR>
  245. " ,ipy: pythonを非同期で起動
  246. nnoremap <silent> ,ipy :VimShellInteractive python<CR>
  247. " ,irb: irbを非同期で起動
  248. nnoremap <silent> ,irb :VimShellInteractive irb<CR>
  249. " ,ss: 非同期で開いたインタプリタに現在の行を評価させる
  250. vmap <silent> ,ss :VimShellSendString<CR>
  251. " 選択中に,ss: 非同期で開いたインタプリタに選択行を評価させる
  252. nnoremap <silent> ,ss <S-v>:VimShellSendString<CR>
  253. " ,vs: vimshell
  254. nnoremap <silent> ,vs :tabnew +VimShell<CR>
  255. " ,vr: .vimrc
  256. nnoremap <silent> ,vr :tabnew ~/.vimrc<CR>
  257. nnoremap <silent> ,so :so ~/.vimrc<CR>
  258. nnoremap <silent> ,nu :tabnew +Unite\ neobundle/update<CR>
  259. nnoremap <silent> ,ll :tabnew +LingrLaunch<CR>
  260. nnoremap <Esc><Esc> :nohlsearch<CR><ESC>
  261. if neobundle#is_installed('neocomplcache')
  262. let g:neocomplcache_enable_at_startup = 1
  263. let g:neocomplcache_enable_smart_case = 1
  264. let g:neocomplcache_enable_camel_case_completion = 1
  265. let g:neocomplcache_enable_underbar_completion = 1
  266. let g:neocomplcache_min_syntax_length = 3
  267. endif
  268. if neobundle#is_installed('neocomplete.vim')
  269. let g:neocomplete#enable_at_startup = 1
  270. let g:neocomplete#enable_smart_case = 1
  271. let g:neocomplete#enable_camel_case_completion = 1
  272. let g:neocomplete#enable_underbar_completion = 1
  273. let g:neocomplete#min_syntax_length = 3
  274. endif
  275. let g:vimfiler_as_default_explorer = 1
  276. "let g:neocomplcache#sources#rsense#home_directory = '/opt/rsense-0.3/'
  277. let g:neocomplcache_text_mode_filetypes = {
  278. \ 'tex': 1,
  279. \ 'plaintex': 1,
  280. \}
  281. "tabで補完候補の選択を行う
  282. inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
  283. inoremap <expr><S-TAB> pumvisible() ? "\<Up>" : "\<S-TAB>"
  284. let g:OmniSharp_host = 'http://localhost:2020'
  285. let g:OmniSharp_typeLookupInPreview = 1
  286. setlocal omnifunc=OmniSharp#Complete
  287. set noshowmatch
  288. let g:netrw_nogx = 1
  289. nmap gx <Plug>(openbrowser-smart-search)
  290. vmap gx <Plug>(openbrowser-smart-search)
  291. let g:quickrun_config = {}
  292. let g:quickrun_config['markdown'] = {
  293. \ 'outputter': 'browser'
  294. \ }
  295. let g:quickrun_config.ruby = {
  296. \ 'command': 'ruby',
  297. \ 'exec': '/usr/bin/env ruby %s',
  298. \ 'tempfile': '{tempname()}.rb'
  299. \ }
  300. let g:quickrun_config = {
  301. \ 'cpp': {
  302. \ 'cmdopt': '-std=c++11 -Wall'
  303. \ }
  304. \ }
  305. let g:quickrun_config = {
  306. \ '_' : {
  307. \ 'hook/close_unite_quickfix/enable_hook_loaded' : 1,
  308. \ 'hook/unite_quickfix/enable_failure' : 1,
  309. \ 'hook/close_quickfix/enable_exit' : 1,
  310. \ 'hook/close_buffer/enable_failure' : 1,
  311. \ 'hook/close_buffer/enable_empty_data' : 1,
  312. \ 'outputter' : 'multi:buffer:quickfix',
  313. \ 'hook/u_nya_/enable' : 1,
  314. \ 'hook/sweep/enable' : 0,
  315. \ 'outputter/buffer/split' : ':botright 15sp',
  316. \ 'outputter/buffer/running_mark' : 'バン(∩`・ω・)バンバンバンバン゙ン',
  317. \ 'runner' : 'vimproc',
  318. \ 'runner/vimproc/updatetime' : 40,
  319. \ 'runner/vimproc/sleep' : 0,
  320. \ }
  321. \ }
  322. let g:lingr_vim_user = 'raa0121'
  323. let g:J6uil_display_offline = 0
  324. let g:J6uil_display_online = 0
  325. let g:J6uil_echo_presence = 1
  326. let g:J6uil_display_icon = 0
  327. let g:J6uil_display_interval = 0
  328. let g:J6uil_updatetime = 1000
  329. augroup plugin-lingr-vim
  330. autocmd!
  331. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  332. autocmd FileType lingr-say let &syntax='clojure'
  333. augroup END
  334. augroup vimrc
  335. autocmd!
  336. augroup END
  337. function! s:SID_PREFIX()
  338. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  339. endfunction
  340. set titlelen=100
  341. set guioptions-=e
  342. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  343. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  344. if exists('$TMUX') || exists('$WINDOW')
  345. set t_ts=k
  346. set t_fs=\
  347. endif
  348. function! s:titlestring()
  349. if &filetype =~ '^lingr'
  350. let &titlestring = 'lingr: ' . lingr#unread_count()
  351. else
  352. let &titlestring = bufname('')
  353. endif
  354. endfunction
  355. " tabline
  356. set showtabline=2 " always show tabline
  357. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  358. function! s:tabline()
  359. " show each tab
  360. let s = ''
  361. for i in range(1, tabpagenr('$'))
  362. let list = tabpagebuflist(i)
  363. let nr = tabpagewinnr(i)
  364. let current_tabnr = tabpagenr()
  365. "let title = bufname('')
  366. if i == current_tabnr
  367. let title = fnamemodify(getcwd(), ':t') . '/'
  368. "let title = bufname('')
  369. else
  370. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  371. endif
  372. let title = empty(title) ? '[No Name]' : title
  373. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  374. let s .= '%' . i . 'T[' . i . '] ' . title
  375. let s .= ' '
  376. endfor
  377. " show lingr unread count
  378. let lingr_unread = ""
  379. if exists('*lingr#unread_count')
  380. let lingr_unread_count = lingr#unread_count()
  381. if lingr_unread_count > 0
  382. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  383. elseif lingr_unread_count == 0
  384. let lingr_unread = "()"
  385. endif
  386. endif
  387. " build tabline
  388. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  389. return s
  390. endfunction
  391. augroup vimrc-scratch-buffer
  392. autocmd!
  393. " Make a scratch buffer when unnamed buffer.
  394. autocmd BufEnter * call s:scratch_buffer()
  395. autocmd FileType qfreplace autocmd! vimrc-scratch * <buffer>
  396. function! s:scratch_buffer()
  397. if exists('b:scratch_buffer') || bufname('%') !=# '' || &l:buftype !=# ''
  398. return
  399. endif
  400. let b:scratch_buffer = 1
  401. call openbuf#add('scratch', bufnr('%'))
  402. setlocal buftype=nofile nobuflisted noswapfile bufhidden=hide
  403. augroup vimrc-scratch
  404. autocmd! * <buffer>
  405. autocmd BufWriteCmd <buffer> call s:scratch_on_BufWriteCmd()
  406. augroup END
  407. endfunction
  408. function! s:scratch_on_BufWriteCmd()
  409. silent! setl buftype< buflisted< swapfile< bufhidden< nomodified
  410. autocmd! vimrc-scratch * <buffer>
  411. if bufname('%') ==# '' && exists('b:scratch_buffer')
  412. execute 'saveas' . (v:cmdbang ? '!' : '') ' <afile>'
  413. filetype detect
  414. endif
  415. call openbuf#remove('scratch', bufnr('%'))
  416. unlet! b:scratch_buffer
  417. endfunction
  418. augroup END
  419. command! -nargs=? ExtractMatches let s:pat = empty(<q-args>) ? @/ : <q-args> | let s:result = filter(getline(1, '$'), 'v:val =~# s:pat') | new | put =s:result
  420. command! -nargs=? UniGrep let s:pat = empty(<q-args>) ? @/ : <q-args> | execute 'Unite grep:%::' . escape(s:pat, '\')
  421. let g:github_user = 'raa0121'
  422. let g:github_token = 'e3ded9cf6669cc31dbca'
  423. let g:github#user = 'raa0121'