startify.vim 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. augroup startify
  11. if !get(g:, 'startify_disable_at_vimenter')
  12. autocmd VimEnter * nested call s:genesis()
  13. endif
  14. if get(g:, 'startify_session_persistence')
  15. autocmd VimLeave * call s:extinction()
  16. endif
  17. augroup END
  18. function! s:genesis()
  19. if !argc() && (line2byte('$') == -1) && (v:progname =~? '^[-gmnq]\=vim\=x\=\%[\.exe]$')
  20. if get(g:, 'startify_session_autoload') && filereadable('Session.vim')
  21. source Session.vim
  22. else
  23. call startify#insane_in_the_membrane()
  24. endif
  25. endif
  26. autocmd startify BufNewFile,BufRead * if exists('v:oldfiles') | call insert(v:oldfiles, expand('<afile>'), 0) | endif
  27. autocmd! startify VimEnter
  28. endfunction
  29. function! s:extinction()
  30. if exists('v:this_session') && filewritable(v:this_session)
  31. call startify#session_write(fnameescape(v:this_session))
  32. endif
  33. endfunction
  34. command! -nargs=? -bar -complete=customlist,startify#session_list SSave call startify#session_save(<f-args>)
  35. command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load(<f-args>)
  36. command! -nargs=? -bar -complete=customlist,startify#session_list SDelete call startify#session_delete(<f-args>)
  37. command! -nargs=0 -bar SClose call startify#session_close()
  38. command! -nargs=0 -bar Startify call startify#insane_in_the_membrane()
  39. nnoremap <silent><plug>(startify-open-buffers) :<c-u>call startify#open_buffers()<cr>