dotfiles/.config/nvim/lua/session.lua

24 lines
551 B
Lua

local Session = {}
function Session.save()
vim.cmd("execute 'mksession! ' . getcwd() . '/.session.vim'")
end
function Session.restore()
if vim.filereadable(getcwd() . '/.session.vim')
let initial_args = argv()
execute 'so ' . getcwd() . '/.session.vim'
for file in initial_args
if bufloaded(file) != 1
execute 'tabnew ' . getcwd() . '/' . file
else
execute 'sb ' . file
endif
endfor
let g:session = 1
endif
end
return Session