Save and Load sessions without :mksessions
There are many plugins to save and restore current session to file.
I used some plugins which wrapped native :mksession
of neovim. But the :mksession
and restore
command doesn't work what I expected. They omitted some files from opened buffer.
And some plugins have too heavy features to use this plugin for just saving last session.
So I made this plugin without using :mksession
and restore opened buffer files correctly when VimLeave.
It is still developing, so I'll fix it continuously until I satisfied.
-- lazy.nvim
return {
'Jaehaks/last-session.nvim',
branch = 'main',
opts = {}
}
-- This is default configuration
opts = {
auto_save = false, -- save last session automatically when VimLeave
path = vim.fn.stdpath('data') .. '/last-session/last-session.txt',
ignored_list = {
ignored_type = {}, -- List of file extensions or filetypes to ignore
ignored_dir = {}, -- List of directory path patterns to ignore
}
}
It is table which includes filetype, extension or directory string pattern to ignore for session
-- example
ignored_list = {
ignored_type = {
'help',
},
ignored_dir = {
'doc\\',
}
}