소스 검색

Sessions: filter foox.vim only if foo.vim exists

We used to filter all sessions ending with "x.vim", because of session extra
files. (See 10. in `:h :mks`.)

To avoid false positives, we now only filter a session "foox.vim", if there is
also an accompanying session "foo.vim".

References #259.
Marco Hinz 9 년 전
부모
커밋
28cfff5ba9
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      autoload/startify.vim

+ 4 - 2
autoload/startify.vim

@@ -569,8 +569,10 @@ endfunction
 
 " Function: s:show_sessions {{{1
 function! s:show_sessions() abort
-  let sfiles = filter(split(globpath(s:session_dir, '*'), '\n'),
-        \ 'v:val !~# "x\.vim$" && v:val !~# "__LAST__$"')
+  let sfiles = split(globpath(s:session_dir, '*'), '\n')
+  let sfiles = filter(sfiles, 'v:val !~# "__LAST__$"')
+  let sfiles = filter(sfiles,
+        \ '!(v:val =~# "x\.vim$" && index(sfiles, v:val[:-6].".vim") >= 0)')
   if empty(sfiles)
     if exists('s:last_message')
       unlet s:last_message