Table of contents jumps to main TeX file, not buffer

Bug #826532 reported by Mark Reid
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Vim LaTeX Box
Fix Committed
Undecided
Unassigned

Bug Description

I use a main TeX file set by `:let b:main_tex_file=main.tex` while I'm editing `included.tex`. The table of contents is correctly generated for the section structure in `included.tex` but when I want to navigate to a section in `included.tex` the `main.tex` file is opened instead.

The following patch to `motion.vim` seems to fix the problem. It jumps to the nearest match in the current buffer instead of the `.tex` file associated with the main tex file's `.aux` file:

diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim
index 3272eaf..770766b 100644
--- a/ftplugin/latex-box/motion.vim
+++ b/ftplugin/latex-box/motion.vim
@@ -272,7 +272,8 @@ function! s:ReadTOC(auxfile)
                let text = substitute(text, '^{\+\|}\+$', '', 'g')

                " add TOC entry
- call add(toc, {'file': fnamemodify(a:auxfile, ':r') . '.tex',
+
+ call add(toc, {'file': bufname('%'),
                                        \ 'level': level, 'number': secnum, 'text': text, 'page': page})
        endfor

Revision history for this message
Mark Reid (3y9m-mark-fkzs) wrote :

Removed comments from initial patch

description: updated
Changed in vim-latex-box:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.