.vimrc 17 KB

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