.vimrc 17 KB

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