Ok, so if you're not setting position on a BufRead, then your BufAdd autocmd
causes the file to open in a new tab. But Vim loses track of the fact that
it is in the middle of jumping somewhere. Probably this is because you're
messing with windows and such before Vim even reads in the buffer contents.
> If I then close the tab (returning to the original file (1)), and hit C-]
> again (on the same function call (A)), it then jumps to file (2) correctly
> positioning the cursor on the function declaration, but interestingly,
> does not open file (2) in a new tab, but instead re-uses the existing one
> (as it would if the function declaration was in the same file).
I bet this is because the buffer is already in your buffer list, so BufAdd
doesn't fire. How did you close the tab? You can try using :bdelete or
:bwipe instead of :tabclose or :close or :quit to see if that makes a
difference. But I think BufAdd is just the wrong event to use for this
autocmd, because it causes this problem and also potentially the problem
with interrupting a tag jump.
>
> If enable BufReadPost, but disable au BufAdd,BufNewFile..., then all works
> perfectly, but without tabs obviously.
>
I think instead of BuffAdd, I'd first try BufWinEnter. If that doesn't work,
then maybe BufReadPost would work.
I normally close the tab with :q, but :bdelete and :bwipe do the same.
> >
> > If enable BufReadPost, but disable au BufAdd,BufNewFile..., then all works
> > perfectly, but without tabs obviously.
> >
>
> I think instead of BuffAdd, I'd first try BufWinEnter. If that doesn't work,
> then maybe BufReadPost would work.
Spent some time brushing up on events at
http://vimdoc.sourceforge.net/htmldoc/autocmd.html#{event}
Sadly, "au BufWinEnter * nested tab sball" results in the error
"E435: Couldn't find tag, just guessing"
And so does "au BufReadPost * nested tab sball"
At times like this I wish I could slip into an alternate universe for a few weeks or months and study the problem to the exclusion of all else in as much depth as required until a solution is found, then return to "now" where my eyelids have yet to complete their last lubricating blink and be hailed an all-knowing demi god.
oh well.
Does the suggested workaround of issuing a second tag jump command get you the desired behavior? I'm kind of out of ideas after that since different autocmd events don't seem to avoid the problem.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/juMNxDig_O4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+u...@googlegroups.com.