From 5589bdb6d36425578347c6d8cd6b3bc771ab90a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Fri, 16 Sep 2022 08:35:42 +0200 Subject: [PATCH] fix: error in toggle_math refer: #2488 --- autoload/vimtex/env.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/vimtex/env.vim b/autoload/vimtex/env.vim index 95ead49559..081eaacc05 100644 --- a/autoload/vimtex/env.vim +++ b/autoload/vimtex/env.vim @@ -297,8 +297,10 @@ function! vimtex#env#toggle_math() abort " {{{1 let [l:open, l:close] = vimtex#env#get_surrounding('math') if empty(l:open) | return | endif - call vimtex#env#change(l:open, l:close, - \ get(g:vimtex_env_toggle_math_map, l:open.match, '$')) + let l:current = get(l:open, 'name', l:open.match) + let l:target = get(g:vimtex_env_toggle_math_map, l:current, '$') + + call vimtex#env#change(l:open, l:close, l:target) endfunction " }}}1