From 2d16cd8da448282a6c71efcf878223a0c2ea89db Mon Sep 17 00:00:00 2001 From: Bruno Thiago Date: Mon, 9 Sep 2024 16:01:58 -0300 Subject: [PATCH 1/2] feat: latext macro --- plugin/surround.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugin/surround.vim b/plugin/surround.vim index 8a4016e..2c4a15a 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -231,6 +231,17 @@ function! s:wrap(string,char,type,removed,special) let after = ' ' . after endif endif + elseif newchar ==# 'm' || newchar ==# 'M' + let fnc = input('macro: ') + if fnc != "" + let s:input = fnc."\" + let before = substitute(fnc,'{$','','').'{' + let after = '}' + if newchar ==# 'M' + let before .= ' ' + let after = ' ' . after + endif + endif elseif newchar ==# "\" let fnc = input('function: ') let s:input = fnc."\" From 9a46d3c57e833551ccf4ef1370bae6dd6ea23fd1 Mon Sep 17 00:00:00 2001 From: Bruno Thiago Date: Mon, 9 Sep 2024 16:25:21 -0300 Subject: [PATCH 2/2] feat: auto adding \ --- plugin/surround.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/surround.vim b/plugin/surround.vim index 2c4a15a..7d11811 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -232,10 +232,10 @@ function! s:wrap(string,char,type,removed,special) endif endif elseif newchar ==# 'm' || newchar ==# 'M' - let fnc = input('macro: ') + let fnc = input('macro: \') if fnc != "" let s:input = fnc."\" - let before = substitute(fnc,'{$','','').'{' + let before = '\' . substitute(substitute(fnc, '^\','',''),'{$','','').'{' let after = '}' if newchar ==# 'M' let before .= ' '