-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
auto-session.lua
72 lines (61 loc) · 1.82 KB
/
auto-session.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local util = require('one.util')
local Auto = {
'rmagatti/auto-session',
config = function(config)
vim.o.sessionoptions = config.session.session_options
require('auto-session').setup(config.session.main)
end,
defaultConfig = {
{ 'session', 'main' },
{
log_level = 'warn',
auto_session_enable_last_session = true,
auto_session_root_dir = util.dataPath('sessions'),
auto_session_enabled = true,
auto_session_create_enabled = true,
auto_save_enabled = nil,
auto_restore_enabled = nil,
auto_session_suppress_dirs = {},
auto_session_use_git_branch = false,
bypass_session_save_file_types = { 'alpha', 'neo-tree' },
cwd_change_handling = {
restore_upcoming_session = true, -- already the default, no need to specify like this, only here as an example
pre_cwd_changed_hook = nil, -- already the default, no need to specify like this, only here as an example
post_cwd_changed_hook = function() -- example refreshing the lualine status line _after_ the cwd changes
require('lualine').refresh() -- refresh lualine so the new session name is displayed in the status bar
end,
},
},
},
}
local Lens = {
'rmagatti/session-lens',
defaultConfig = {
{ 'session', 'lens' },
{
-- prompt_title = '',
path_display = {
shorten = {
len = 2, -- shorten into 2 letters
exclude = { 1, -2, -1 }, -- exclude the first, the last and last second words in path
},
},
theme_conf = { border = true },
previewer = true,
},
},
config = function(config)
require('session-lens').setup(config.session.lens)
end,
}
local M = {
requires = { Auto, Lens },
defaultConfig = {
{ 'session' },
{ session_options = 'blank,curdir,folds,help,tabpages,winpos,winsize' },
},
config = function(config)
vim.o.sessionoptions = config.session.session_options
end,
}
return M