From ed22be731a8073b7d6caa1ca4b803bbff756eada Mon Sep 17 00:00:00 2001 From: Diogo Duarte Date: Tue, 20 Feb 2024 18:16:17 +0000 Subject: [PATCH] fix: allow running `ya.sync` in a sync plugin call (#702) --- yazi-plugin/preset/ya.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yazi-plugin/preset/ya.lua b/yazi-plugin/preset/ya.lua index 7cf6fa69..97ffb545 100644 --- a/yazi-plugin/preset/ya.lua +++ b/yazi-plugin/preset/ya.lua @@ -29,6 +29,10 @@ function ya.flat(t) end function ya.sync(f) + if ya.SYNC_ON then + return function(...) f(...) end + end + YAZI_SYNC_BLOCKS = YAZI_SYNC_BLOCKS + 1 if YAZI_SYNC_CALLS == YAZI_SYNC_BLOCKS then YAZI_SYNC_ENTRY = f