From e3f0a91d630dad34256609900824e51a320c0c48 Mon Sep 17 00:00:00 2001 From: Mintimate Date: Wed, 27 Mar 2024 21:44:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B0=8F=E9=B9=A4=E5=8F=8C=E6=8B=BC):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=A6=E5=8F=91=E5=AD=97=E4=B8=8Ekey=5Fbin?= =?UTF-8?q?der=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolved: #53 Co-Authored-By: mirtlecn <76689045+mirtlecn@users.noreply.github.com> --- lua/auxCode_filter.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/auxCode_filter.lua b/lua/auxCode_filter.lua index ed56d2d..a605f00 100644 --- a/lua/auxCode_filter.lua +++ b/lua/auxCode_filter.lua @@ -6,6 +6,10 @@ local AuxFilter = {} +local function alt_lua_punc( s ) + return s:gsub( '([%.%+%-%*%?%[%]%^%$%(%)%%])', '%%%1' ) +end + -- 日志模块 -- local log = require 'log' -- log.outfile = "aux_code.log" @@ -20,6 +24,9 @@ function AuxFilter.init(env) -- 設定預設觸發鍵為分號,並從配置中讀取自訂的觸發鍵 env.trigger_key = config:get_string("axu_code/trigger_word") or ";" + -- 对内容进行替换 + env.trigger_key = alt_lua_punc( env.trigger_key ) + -- 设定是否显示辅助码,默认为显示 env.show_aux_notice = config:get_string("axu_code/show_aux_notice") or 'always'