File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,13 @@ function utils.get_sessions()
126126 end
127127 table.sort (sessions , function (a , b ) return a .timestamp > b .timestamp end )
128128
129- -- If the last session is the current one, then preselect the previous one.
130- local cwd = vim .loop .cwd ()
131- if # sessions >= 2 and cwd and config .dir_to_session_filename (cwd ).filename == sessions [1 ].filename then
132- sessions [1 ], sessions [2 ] = sessions [2 ], sessions [1 ]
129+ -- If we are in a session already, show the penultimate saved session on top.
130+ -- If we are not inside a session, show the latest saved session on top.
131+ if utils .is_session then
132+ local cwd = vim .loop .cwd ()
133+ if # sessions >= 2 and cwd and config .dir_to_session_filename (cwd ).filename == sessions [1 ].filename then
134+ sessions [1 ], sessions [2 ] = sessions [2 ], sessions [1 ]
135+ end
133136 end
134137
135138 return sessions
You can’t perform that action at this time.
0 commit comments