tagbar
tagbar copied to clipboard
Show wrong taginfo for LaTeX file
See the screenshot
The test tex file is here
Can you reproduce the same problem? I'm using the ctags-dev version and Vim-7.4. I have dumped the tags by running ctags
directly on the console and the tags looks good to me. I'm very confused about the wrong taginfo.
Besides, if I only open one file, the jumping seems OK even though the wrong taginfo is shown. But if I open multiple LaTeX files, hitting <CR> will jump into the minibufexpl window, it is very annoying.
The line numbers in tags seems wrong after I forcing ctags to show them. E.g. \chapter{}
at the 1st line will generate line 0
in the tag file.
The problem of switching to the window of MiniBufExpl can be mitigated since hitting 'Enter' again on the tag will switch the focus to the right window.
Update:
It is so wired that ctags
works fine if you build it with the debug option cflags=-g
instead of -g -O2
, which is default in the original Makefile
. I think this pull request might be caused by the same reason.
For the jumping issue, I've found it is related with the function s:GotoPreviousWindow()
. I changed the two cases of wincmd p
to wincmd b
and it solved my headache. It is a ugly tweak and only works for me (I use minibufexpl and only have one main edit window under the minibufexpl). See more in the comment.
" call s:winexec('wincmd p')
" jzc: The line above often jumps to the buffer window of 'minibufexpl'. I guess 'minibufexpl'
" must have acted quietly to become the 'previous' window. 'wincmd b' forces to jump to the
" our edit window (assuming tagbar is openned at the left-side).
call s:winexec('wincmd b')
I don't have enough time to make a pull request nor I don't believe I can make a good one to make everyone happy. Jan, would you please take a look at this? Thanks!
I'll have a look at whether I can figure out the ctags issue. As for the MiniBufExplorer problem, are you using the latest version from https://github.com/fholgado/minibufexpl.vim? There were several bugfixes there recently that should have fixed that issue.
The latest version of minibufexpl doesn't save session very well. So I still used an old one (I forgot how old). But I have switched to use bufferline
and the wired jumping issue has gone.
Thank you for your reply. I did notice that you committed some changed to the ctag svn so I'm sure you are familiar with ctags' source code.