Skip to content

Commit

Permalink
feat: warn when the yazi version is too old
Browse files Browse the repository at this point in the history
Fixes #32

Note: I could have added support for a yazi version without
--local-events support, but I think it's much better to point the user
to upgrade their yazi version instead so that they also get other fixes
and features with the new yazi version.
  • Loading branch information
mikavilpas committed Apr 21, 2024
1 parent 85bac6b commit 7ad9791
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/yazi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ function M.yazi(config, path)
on_exit = function(_job_id, code, _event)
M.yazi_loaded = false
if code ~= 0 then
print('yazi exited with code', code)
print(
"yazi.nvim: had trouble opening yazi. Run ':checkhealth yazi' for more information."
)
return
end

Expand Down
7 changes: 7 additions & 0 deletions lua/yazi/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ return {
)
end

local yazi_help = vim.fn.system('yazi --help')
if not yazi_help:find('--local-events', 1, true) then
vim.health.warn(
'The yazi version does not support --local-events. Please upgrade to the newest version of yazi.'
)
end

vim.health.ok('yazi')
end,
}

0 comments on commit 7ad9791

Please sign in to comment.