Ver código fonte

New option: g:startify_session_detection

Marco Hinz 12 anos atrás
pai
commit
888dcfbc0d
3 arquivos alterados com 18 adições e 1 exclusões
  1. 4 1
      README.md
  2. 6 0
      autoload/startify.vim
  3. 8 0
      doc/startify.txt

+ 4 - 1
README.md

@@ -48,7 +48,10 @@ See `:h startify-options` for more information.
 
 #### 2) Easy session handling
 
-It eases handling of loading, saving and deleting sessions by always working
+When the file Session.vim is found in the current directory, it will be shown at
+the top of all lists as entry `[0]`.
+
+The handling of loading, saving and deleting sessions is eased by always working
 with one and the same directory. These commands are used for convenience:
 
     :SLoad    load a session

+ 6 - 0
autoload/startify.vim

@@ -46,6 +46,12 @@ function! startify#insane_in_the_membrane() abort
     call append('$', ['   [e]  <empty buffer>', ''])
   endif
 
+  if get(g:, 'startify_session_detection', 1) && filereadable('Session.vim')
+    call append('$', ['   [0]  Session.vim', ''])
+    execute 'nnoremap <buffer> 0 :source Session.vim<cr>'
+    let cnt = 1
+  endif
+
   for list in get(g:, 'startify_list_order', ['files', 'sessions', 'bookmarks'])
     let cnt = s:show_{list}(cnt)
     call append('$', '')

+ 8 - 0
doc/startify.txt

@@ -135,6 +135,14 @@ Example: let g:startify_bookmarks = [ '~/.vimrc' ]
 The number of files to list.
 
 
+============-
+
+    let g:startify_session_detection = 1
+
+When the file Session.vim is found in the current directory, it will be shown at
+the top of all lists as entry [0].
+
+
 ============-
 
     let g:startify_change_to_dir = 1