summaryrefslogtreecommitdiffstats
path: root/ftplugin/latex-box/motion.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-07-29 13:03:49 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2014-07-29 13:03:49 +0200
commit5f1223fbc5285689db812236c9100329740a805b (patch)
tree58bc6f11540011afb25826c96f65fa35f5687291 /ftplugin/latex-box/motion.vim
parenta59f644d49ee029df48586a6c3c358858f1e6739 (diff)
downloadvim-polyglot-1.9.2.tar.gz
vim-polyglot-1.9.2.zip
Major updatev1.9.2
Diffstat (limited to 'ftplugin/latex-box/motion.vim')
-rw-r--r--ftplugin/latex-box/motion.vim26
1 files changed, 12 insertions, 14 deletions
diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim
index 04275aca..41605aea 100644
--- a/ftplugin/latex-box/motion.vim
+++ b/ftplugin/latex-box/motion.vim
@@ -345,24 +345,22 @@ function! s:ReadTOC(auxfile, texfile, ...)
endif
" parse section number
let secnum = ''
- if len(tree[1]) > 3 && empty(tree[1][1])
- call remove(tree[1], 1)
+ let tree = tree[1]
+ if len(tree) > 3 && empty(tree[1])
+ call remove(tree, 1)
endif
- if len(tree[1]) > 1 && tree[1][0] =~ '\(numberline\|tocsection\)'
- if !empty(tree[1][1])
- let secnum = LatexBox_TreeToTex(tree[1][1])
- let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
- let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
- let secnum = substitute(secnum, '^{\+\|}\+$', '', 'g')
- endif
- let tree = tree[1][2:]
- else
- let tree = tree[1]
+ if len(tree) > 1 && tree[0] =~ '^\\\(numberline\|tocsection\)'
+ let secnum = LatexBox_TreeToTex(tree[1])
+ let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
+ let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
+ let secnum = substitute(secnum, '^{\+\|}\+$', '', 'g')
+ call remove(tree, 1)
endif
" parse section title
let text = LatexBox_TreeToTex(tree)
- let text = substitute(text, '^{\+\|}\+$', '', 'g')
- let text = substitute(text, '\*', '', 'g')
+ let text = substitute(text, '^{\+\|}\+$', '', 'g')
+ let text = substitute(text, '\m^\\\(no\)\?numberline\s*', '', '')
+ let text = substitute(text, '\*', '', 'g')
" add TOC entry
call add(fileindices[texfile], len(toc))