From 6007ece6a7d712e091fef5a62985b3291748953a Mon Sep 17 00:00:00 2001 From: Justin Gassner Date: Wed, 29 Nov 2023 13:31:15 +0100 Subject: Make special keys work --- lua/my-quicktex-keywords/init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/my-quicktex-keywords/init.lua b/lua/my-quicktex-keywords/init.lua index 18c5c90..54484f4 100644 --- a/lua/my-quicktex-keywords/init.lua +++ b/lua/my-quicktex-keywords/init.lua @@ -5,6 +5,14 @@ local mode = { normal = 0, math = 1, both = 2 } local quicktex_tex = {} local quicktex_math = {} +local function insert_special_keys(str) + local ret = str + ret = string.gsub(ret, '', string.char(8)) + ret = string.gsub(ret, '', string.char(13)) + ret = string.gsub(ret, '', string.char(27)) + return ret +end + local function read_item(line) if string.match(line, '^#') then return @@ -64,7 +72,7 @@ local function read_item(line) local cap1, cap2 = string.match(line, '^(%g+) (.+)') if cap1 then item_keyword = cap1 - item_expansion = cap2 + item_expansion = insert_special_keys(cap2) return item_mode, item_keyword, item_expansion end end @@ -95,6 +103,7 @@ local function generate_quicktex_dictionaries() quicktex_math[' '] = string.char(27) .. ':call quicktex#DoJump()\n' vim.g.quicktex_tex = quicktex_tex vim.g.quicktex_math = quicktex_math + quicktex_tex['M'] = '$$\n<+++>\n$$' vim.g.quicktex_markdown = quicktex_tex end -- cgit v1.2.3-54-g00ecf