File tree 2 files changed +22
-4
lines changed
2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,28 @@ opt.sessionoptions = {
82
82
' winsize' ,
83
83
' winpos' ,
84
84
}
85
- opt .shadafile = ' .vim.shada' -- disable global shada; make jumplist local to project
85
+
86
+ -- disable global shada; create separate shadafile for each workspace
87
+ -- ensures project-scoped jumplist, marks, etc.
88
+ -- —@return string?
89
+ local shadafile = function ()
90
+ local cwd = vim .uv .cwd ()
91
+ if not cwd then
92
+ return
93
+ end
94
+ local config = vim .fn .stdpath ' config' --[[ @as string]]
95
+ local rel_to_config = vim .fs .relpath (config , cwd )
96
+ local workspace_root = rel_to_config and config or Snacks .git .get_root (cwd )
97
+ if not workspace_root then
98
+ return
99
+ end
100
+ local workspace_uid = vim .fs .basename (workspace_root )
101
+ .. ' _'
102
+ .. vim .fn .sha256 (workspace_root ):sub (1 , 8 )
103
+ return vim .fn .stdpath ' state' .. ' /shada/' .. workspace_uid .. ' .shada'
104
+ end
105
+ vim .o .shadafile = shadafile () or ' NONE'
106
+
86
107
opt .completeopt = { ' menu' , ' menuone' , ' noselect' } -- Completion options
87
108
opt .clipboard = ' unnamedplus'
88
109
opt .inccommand = ' nosplit'
Original file line number Diff line number Diff line change 1
1
# macOS
2
2
* .DS_Store
3
3
4
- # Neovim
5
- .vim.shada
6
-
7
4
# ## Python
8
5
# Byte-compiled / optimized / DLL files
9
6
__pycache__ /
You can’t perform that action at this time.
0 commit comments