" Autoload functions to handle (native/Obsession) sessions " Last Changed: 2019-01-27 " Author: Federico Igne <> " License: This file is placed in the public domain. function! dyamon#session#new(...) abort " If Obsession cmd is availble use it (fallback to `mksession`) let l:cmd = exists(':Obsession') ? 'Obsession' : 'mksession!' " If no argument is provided, the default session name is the " current working directory. let l:default = $VIM_SESSIONS . '/' . \ substitute(fnamemodify(getcwd(),':t'), '\v^\.', '', '') . \ '.vim' let l:session = get(a:, 1, l:default) " Create new session (or load existing one). execute l:cmd . ' ' . l:session endfunction