startify.vim 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. " Plugin: https://github.com/mhinz/vim-startify
  2. " Description: Start screen displaying recently used stuff.
  3. " Maintainer: Marco Hinz <http://github.com/mhinz>
  4. " Version: 1.0
  5. if exists('g:autoloaded_startify') || &cp
  6. finish
  7. endif
  8. let g:autoloaded_startify = 1
  9. function! startify#save_session(...) abort
  10. let spath = g:startify_session_dir .'/'. (exists('a:1') ? a:1 : input('Save under this session name: ')) | redraw
  11. if !filereadable(spath)
  12. execute 'mksession '. spath | echo 'Session saved under: '. spath
  13. return
  14. endif
  15. echo 'Session already exists. Overwrite? [y/n]' | redraw
  16. if nr2char(getchar()) == 'y'
  17. execute 'mksession! '. spath | echo 'Session saved under: '. spath
  18. else
  19. echo 'Did NOT save the session!'
  20. endif
  21. endfunction
  22. function! startify#load_session(...) abort
  23. let spath = g:startify_session_dir .'/'. (exists('a:1') ? a:1 : input('Load this session: ')) | redraw
  24. if filereadable(spath)
  25. execute 'source '. spath
  26. else
  27. echo 'No such file: '. spath
  28. endif
  29. endfunction
  30. " vim: et sw=2 sts=2