From e3c653154fdd361668c2d18477faabb8990c5a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Wed, 4 Sep 2024 21:45:51 +0800 Subject: [PATCH] feat: add `dict_merge()` function (#1609) --- yazi-plugin/preset/ya.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yazi-plugin/preset/ya.lua b/yazi-plugin/preset/ya.lua index 23ebe016..8e0847f5 100644 --- a/yazi-plugin/preset/ya.lua +++ b/yazi-plugin/preset/ya.lua @@ -21,7 +21,12 @@ function ya.list_merge(a, b) return a end -function ya.basename(s) return s:gsub("(.*[/\\])(.*)", "%2") end +function ya.dict_merge(a, b) + for k, v in pairs(b) do + a[k] = v + end + return a +end function ya.readable_size(size) local units = { "B", "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q" }