startify.vim 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. " vim: et sw=2 sts=2
  2. " Plugin: https://github.com/mhinz/vim-startify
  3. " Description: Start screen displaying recently used stuff.
  4. " Maintainer: Marco Hinz <http://github.com/mhinz>
  5. " Version: 1.8
  6. if exists('g:loaded_startify') || &cp
  7. finish
  8. endif
  9. let g:loaded_startify = 1
  10. let g:startify_locked = 0
  11. augroup startify
  12. if !get(g:, 'startify_disable_at_vimenter')
  13. autocmd VimEnter * nested call s:genesis()
  14. endif
  15. if get(g:, 'startify_session_persistence')
  16. autocmd VimLeave * call s:extinction()
  17. endif
  18. autocmd QuickFixCmdPre *vimgrep* let g:startify_locked = 1
  19. autocmd QuickFixCmdPost *vimgrep* let g:startify_locked = 0
  20. augroup END
  21. function! s:genesis()
  22. if !argc() && (line2byte('$') == -1) && (v:progname =~? '^[-gmnq]\=vim\=x\=\%[\.exe]$')
  23. if get(g:, 'startify_session_autoload') && filereadable('Session.vim')
  24. source Session.vim
  25. else
  26. call startify#insane_in_the_membrane()
  27. endif
  28. endif
  29. autocmd startify BufNewFile,BufRead *
  30. \ if !g:startify_locked && exists('v:oldfiles') |
  31. \ call insert(v:oldfiles, expand('<afile>'), 0) |
  32. \ endif
  33. autocmd! startify VimEnter
  34. endfunction
  35. function! s:extinction()
  36. if exists('v:this_session') && filewritable(v:this_session)
  37. call startify#session_write(fnameescape(v:this_session))
  38. endif
  39. endfunction
  40. command! -nargs=? -bar -complete=customlist,startify#session_list SSave call startify#session_save(<f-args>)
  41. command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load(<f-args>)
  42. command! -nargs=? -bar -complete=customlist,startify#session_list SDelete call startify#session_delete(<f-args>)
  43. command! -nargs=0 -bar SClose call startify#session_close()
  44. command! -nargs=0 -bar Startify call startify#insane_in_the_membrane()
  45. nnoremap <silent><plug>(startify-open-buffers) :<c-u>call startify#open_buffers()<cr>