From fa27d5764fc87bd4560c3e59171d1265fe9154eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Mon, 4 Apr 2016 22:14:37 +0200 Subject: [PATCH] Allow to get environment commands --- autoload/vimtex/cmd.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/vimtex/cmd.vim b/autoload/vimtex/cmd.vim index 41a646b..c99f8c4 100644 --- a/autoload/vimtex/cmd.vim +++ b/autoload/vimtex/cmd.vim @@ -159,8 +159,18 @@ function! s:get_cmd(direction) " {{{1 \ 'name' : match, \ 'pos_start' : { 'lnum' : lnum, 'cnum' : cnum }, \ 'pos_end' : { 'lnum' : lnum, 'cnum' : cnum + strlen(match) - 1 }, + \ 'args' : [], \} + " Environments always start with environment name and allows option + " afterwords + if res.name ==# '\begin' + let arg = s:get_cmd_part('{', res.pos_end) + call add(res.args, arg) + let res.pos_end.lnum = arg.close.lnum + let res.pos_end.cnum = arg.close.cnum + endif + " Get options let res.opt = s:get_cmd_part('[', res.pos_end) if !empty(res.opt) @@ -170,7 +180,6 @@ function! s:get_cmd(direction) " {{{1 " Get arguments let arg = s:get_cmd_part('{', res.pos_end) - let res.args = [] while !empty(arg) call add(res.args, arg) let res.pos_end.lnum = arg.close.lnum