startify.vim 1.8 KB

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