From d4f41a9b2a6d94d82a34d643597e6047e3247a79 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sat, 31 Dec 2022 07:30:22 +0000 Subject: [PATCH] allow creating starred command --- autoload/vimtex/cmd.vim | 2 +- test/test-commands/test-insert-cmd.vim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/vimtex/cmd.vim b/autoload/vimtex/cmd.vim index 125f535b93..188edd819c 100644 --- a/autoload/vimtex/cmd.vim +++ b/autoload/vimtex/cmd.vim @@ -126,7 +126,7 @@ endfunction function! vimtex#cmd#create_insert() abort " {{{1 if mode() !=# 'i' | return | endif - let l:re = '\v%(^|\A)\zs\a+\ze%(\A|$)' + let l:re = '\v%(^|\A)\zs\a+(\*=)@>\a*\ze%(\A|$)' let l:c0 = col('.') - 1 let [l:l1, l:c1] = searchpos(l:re, 'bcn', line('.')) diff --git a/test/test-commands/test-insert-cmd.vim b/test/test-commands/test-insert-cmd.vim index b01f8f7783..fdf9c35871 100644 --- a/test/test-commands/test-insert-cmd.vim +++ b/test/test-commands/test-insert-cmd.vim @@ -7,6 +7,8 @@ setfiletype tex " F7 / Insert command (insert mode, normal mode and visual mode) call vimtex#test#keys("lla\}", 'foobar', '\foo{bar}') +call vimtex#test#keys("llla\bar}", 'foo*', '\foo{bar}') +call vimtex#test#keys("llla\}", 'foo*bar', '\foo{bar}') call vimtex#test#keys("fbve\emph\", 'foobar', 'foo\emph{bar}') call vimtex#test#keys("\emph\", 'foo', '\emph{foo}')