Skip to content

Commit

Permalink
Merge pull request thaerkh#5 from dmalkr/master
Browse files Browse the repository at this point in the history
Handling absolute path to session
  • Loading branch information
thaerkh authored Aug 6, 2017
2 parents 841f255 + 233412c commit 27c6ac2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugin/workspace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ let g:workspace_autosave_au_updatetime = get(g:, 'workspace_autosave_au_updateti
let g:workspace_autocreate = get(g:, 'workspace_autocreate', 0)
let g:workspace_nocompatible = get(g:, 'workspace_nocompatible', 1)


function! s:WorkspaceExists()
return filereadable(g:workspace_session_name)
endfunction

function! s:IsAbsolutePath(path)
return (fnamemodify(a:path, ':p') == a:path)
endfunction

function! s:MakeWorkspace(workspace_save_session)
if a:workspace_save_session == 1 || get(s:, 'workspace_save_session', 0) == 1
let s:workspace_save_session = 1
execute printf('mksession! %s/%s', getcwd(), g:workspace_session_name)
if s:IsAbsolutePath(g:workspace_session_name)
execute printf('mksession! %s', g:workspace_session_name)
else
execute printf('mksession! %s/%s', getcwd(), g:workspace_session_name)
endif
endif
endfunction

Expand Down

0 comments on commit 27c6ac2

Please sign in to comment.