.vimrc 16 KB

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