Sorry to Ben if you receive this twice~
>
> I'd rather just use the :drop command, which will jump to another
> window if that other window already contains the file in question, re-
> use the current window, or split a new window if the current buffer
> cannot be abandoned.
>
Yea,:drop is interesting, I didn't know this command before, it should
fit best here.
> > 4. :exe + :normal ^W^W to switch to that window
>
> > 5. use the {cmd} got in 1. to locate the tag
>
> That would be in 2. But I'm not sure of the format. Is this something
> you can just use :execute on?
>
Just realized that you mean {cmd} here, I don't know exactly either,
haven't used this taglist() function before, I just ":tab help" to go
to the help interface and gave it a shot to see what it looks like:
:echo taglist('ex')[0]['cmd']
and it was like:
/*ex*
I guess this *can* be :execute-ed, yet I think now there's a better
approach, see below.
> > Taking all tab pages into account is no problem either, just introduce
> > tabpagenr() and :gt
>
> Even better, :tab drop
>
Shouldn't this open new tabs no matter what? I think the OP prefer
switching to an existing file if it contains the tag in question.
> > <Ctrl-t> is just the other way round.
>
> I think CTRL-T would be very different actually, unless I'm missing
> something. You could accomplish it by storing the current buffer
> number, and using the :sbuffer command and the 'switchbuf' option, but
> more likely if the CTRL-] is implemented as desired you can just
> switch back to the previous window and be where you want to be.
>
Now I'm thinking that maybe just :drop to the target file and let :tag
do the rest would be OK, this way the tag stack would be updated too,
and should make the following <Ctrl-t> indeed the other way round --
just :drop back and :pop.
> > This should work, theoretically. But I haven't tried it.
>
> Here's a more complete script, but I haven't tested it either:
>
> nnoremap! <Ctrl-]> :call <SID>SmartTagSearch()<CR>
>
> function! s:SmartTagSearch()
> " get the first tag hit for the word under the cursor
> let firsttag = taglist(expand("<cword>"))[0]
> " jump to the file containing the tag (in existing window
> if possible)
> execute 'drop' fnameescape(firsttag.filename)
> " jump to the tag itself
> execute firsttag.cmd
> endfunction
>
So my version would be just replacing the "execute firsttag.cmd" with
"exe 'tag ' . firsttag.filename"
> > Plus: what does the "CC" mean?
>
> There have been a few answers, I'm not sure if one of them is correct.
> I actually read somewhere that CC meant "courtesy copy". BCC is
> related, meaning "blind courtesy copy". But apparently the actual
> definitions have long been lost since there are so many ideas for it
> now, even if the meanings are clear.
Interesting that widely-used abbreviation seems to have lost its
origin, thanks to all of you :-)
--
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