.vimrc 17 KB

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