summaryrefslogtreecommitdiffstats
path: root/ftplugin/latextoc.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-04-15 01:05:44 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2014-04-15 01:05:44 +0200
commit610f4c570123510f2d6f4c5799d880d8581126cf (patch)
treea2bbc1de1fbdd22e2b2eb4d4d2447b3cc8467fba /ftplugin/latextoc.vim
parentf3833f5a39b91f1e42f12e45a2e61e351218c495 (diff)
downloadvim-polyglot-610f4c570123510f2d6f4c5799d880d8581126cf.tar.gz
vim-polyglot-610f4c570123510f2d6f4c5799d880d8581126cf.zip
Update
Diffstat (limited to 'ftplugin/latextoc.vim')
-rw-r--r--ftplugin/latextoc.vim11
1 files changed, 4 insertions, 7 deletions
diff --git a/ftplugin/latextoc.vim b/ftplugin/latextoc.vim
index 48f20e3b..01fd9bb0 100644
--- a/ftplugin/latextoc.vim
+++ b/ftplugin/latextoc.vim
@@ -40,13 +40,9 @@ endfunction
" {{{2 EscapeTitle
function! s:EscapeTitle(titlestr)
- " Credit goes to Marcin Szamotulski for the following fix. It allows to
- " match through commands added by TeX.
- let titlestr = substitute(a:titlestr, '\\\w*\>\s*\%({[^}]*}\)\?', '.*', 'g')
-
- let titlestr = escape(titlestr, '\')
- let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g')
-
+ let titlestr = substitute(a:titlestr, '\\[a-zA-Z@]*\>\s*{\?', '.*', 'g')
+ let titlestr = substitute(titlestr, '}', '', 'g')
+ let titlestr = substitute(titlestr, '\%(\.\*\s*\)\{2,}', '.*', 'g')
return titlestr
endfunction
@@ -170,6 +166,7 @@ function! s:TOCOpenBuf(file)
let bnr = bufnr(a:file)
endif
execute 'buffer! ' . bnr
+ normal! gg
endfunction