Skip to content
This repository was archived by the owner on May 29, 2023. It is now read-only.

Commit 27c6ac2

Browse files
authored
Merge pull request #5 from dmalkr/master
Handling absolute path to session
2 parents 841f255 + 233412c commit 27c6ac2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugin/workspace.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ let g:workspace_autosave_au_updatetime = get(g:, 'workspace_autosave_au_updateti
1414
let g:workspace_autocreate = get(g:, 'workspace_autocreate', 0)
1515
let g:workspace_nocompatible = get(g:, 'workspace_nocompatible', 1)
1616

17-
1817
function! s:WorkspaceExists()
1918
return filereadable(g:workspace_session_name)
2019
endfunction
2120

21+
function! s:IsAbsolutePath(path)
22+
return (fnamemodify(a:path, ':p') == a:path)
23+
endfunction
24+
2225
function! s:MakeWorkspace(workspace_save_session)
2326
if a:workspace_save_session == 1 || get(s:, 'workspace_save_session', 0) == 1
2427
let s:workspace_save_session = 1
25-
execute printf('mksession! %s/%s', getcwd(), g:workspace_session_name)
28+
if s:IsAbsolutePath(g:workspace_session_name)
29+
execute printf('mksession! %s', g:workspace_session_name)
30+
else
31+
execute printf('mksession! %s/%s', getcwd(), g:workspace_session_name)
32+
endif
2633
endif
2734
endfunction
2835

0 commit comments

Comments
 (0)