Allow to get environment commands
This commit is contained in:
parent
b94dd3cc6d
commit
fa27d5764f
@ -159,8 +159,18 @@ function! s:get_cmd(direction) " {{{1
|
|||||||
\ 'name' : match,
|
\ 'name' : match,
|
||||||
\ 'pos_start' : { 'lnum' : lnum, 'cnum' : cnum },
|
\ 'pos_start' : { 'lnum' : lnum, 'cnum' : cnum },
|
||||||
\ 'pos_end' : { 'lnum' : lnum, 'cnum' : cnum + strlen(match) - 1 },
|
\ '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
|
" Get options
|
||||||
let res.opt = s:get_cmd_part('[', res.pos_end)
|
let res.opt = s:get_cmd_part('[', res.pos_end)
|
||||||
if !empty(res.opt)
|
if !empty(res.opt)
|
||||||
@ -170,7 +180,6 @@ function! s:get_cmd(direction) " {{{1
|
|||||||
|
|
||||||
" Get arguments
|
" Get arguments
|
||||||
let arg = s:get_cmd_part('{', res.pos_end)
|
let arg = s:get_cmd_part('{', res.pos_end)
|
||||||
let res.args = []
|
|
||||||
while !empty(arg)
|
while !empty(arg)
|
||||||
call add(res.args, arg)
|
call add(res.args, arg)
|
||||||
let res.pos_end.lnum = arg.close.lnum
|
let res.pos_end.lnum = arg.close.lnum
|
||||||
|
Loading…
x
Reference in New Issue
Block a user