mirror of
https://github.com/neovim/neovim.git
synced 2026-04-05 07:09:23 +00:00
healthcheck: fix health check issue with shada file (#13291)
- If the shada file is set with shada option n, use it. - If the shadafile is NONE, it does not check for file read/write access. - If the shada file does not exist, try to create it.
This commit is contained in:
@@ -41,10 +41,27 @@ function! s:check_config() abort
|
||||
\ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ])
|
||||
endif
|
||||
|
||||
let shadafile = (empty(&shadafile) || &shadafile ==# 'NONE') ? stdpath('data').'/shada/main.shada' : &shadafile
|
||||
if !empty(shadafile) && (!filereadable(shadafile) || !filewritable(shadafile))
|
||||
let writeable = v:true
|
||||
let shadafile = substitute(matchstr(
|
||||
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
|
||||
let shadafile = empty(&shadafile) ? empty(shadafile) ?
|
||||
\ stdpath('data').'/shada/main.shada' : expand(shadafile)
|
||||
\ : &shadafile ==# 'NONE' ? '' : &shadafile
|
||||
if !empty(shadafile) && empty(glob(shadafile))
|
||||
" Since this may be the first time neovim has been run, we will try to
|
||||
" create a shada file
|
||||
try
|
||||
wshada
|
||||
catch /.*/
|
||||
let writeable = v:false
|
||||
endtry
|
||||
endif
|
||||
if !writeable || (!empty(shadafile) &&
|
||||
\ (!filereadable(shadafile) || !filewritable(shadafile)))
|
||||
let ok = v:false
|
||||
call health#report_error('shada file is not '.(filereadable(shadafile) ? 'writeable' : 'readable').":\n".shadafile)
|
||||
call health#report_error('shada file is not '.
|
||||
\ ((!writeable || filereadable(shadafile)) ?
|
||||
\ 'writeable' : 'readable').":\n".shadafile)
|
||||
endif
|
||||
|
||||
if ok
|
||||
|
||||
Reference in New Issue
Block a user