Lech Lorens wrote: > I'll try to find some time during the weekend to look into the other > things you'd like to be done. To be 100% sure: you think that it > would be best to get multiple searches done first (or do you mean > removing duplicate tags)?
That's right. But what do you think of my 'tagcmdfunc' idea? That would allow my script to handle multiple successive searches, as well as multiple guesses when a search fails. There'd be no need for the multiple search feature in vim then. It would be left to the script. So 'tagfunc' could put whatever it wants in the tag command, and 'tagcmdfunc' would know what to do with it. Seems the most flexible solution. Although hmm, if taglist() is called by another script it may get something unexpected. Maybe taglist() shouldn't use 'tagfunc' by default? > Thanks for noticing. Will fix that. Meanwhile: > :helptags $VIMRUNTIME/doc Ah! For the life of me I couldn't remember or find how to do that. I kept looking for :doctags! Thanks. Actually I looked at the doc for "write-plugin" expecting to find it there, but no mention of it. Would be a good thing to mention for people writing plugins, no? > > - Can't tag on operator at end of line, eg "b++;". Needs to allow > > this when 'tagfunc' set. > > You can tag an operator. You will want to set 'isk' appropriately. > Probably: > :set isk+=-+ Hmm, I guess, but this will have many other ramifications. The point is that the 'tagfunc' handles things its own way, such as finding valid C++ operators like mine does. Neither vim not the user need know how it's done, so they shouldn't need a special isk setting. I think when 'tagfunc' is set, vim should call it even when it doesn't think there's an identifier under the cursor. It is up to the script to find what it wants. Which leads into... > > However if the tagfunc returns an empty list, how do we know if an > > id wasn't found, or if no tags for it were found (so vim knows > > which error to give)? Maybe return an empty list for > > tag-not-found or 0 for id-not-found? > > There is "E426: tag not found". Id not found? > If you mean "E349: No identifier under cursor", Vim takes care of this, > no need to do this in the 'tagfunc' function. If vim called 'tagfunc' regardless of what is found under the cursor, as I'm suggesting, then it becomes 'tagfunc's responsibility to say whether it found an identifier under the cursor. So I'm suggesting that if it returns 0 it means no id was found, and vim then knows to give the "E349: No identifier under cursor" error. If however it returns an empty list, then it means an id was found, but no tags. In this case vim knows to give the "E426: tag not found" error. > > - ^W^] then ^Wq leaves the original window scrolled sometimes. Not > > sure when exactly. But try this: extract the attached ZIP file and > > open TestTags.cpp. Go to line 332 and use ^E/^Y to put it in the > > bottom half of the screen, towards the bottom. Tag to one of the > > first 4 taggable items (ie b, mNext, mPrev or mA) using ^W], then > > close that window again with ^Wq. The original cursor line is now > > at the top of the window. Strangely it doesn't happen for the > > remaining tags on the line. I think I also saw it only happen when > > the tag was in the top half of the window. Probably the same bug as > > here: http://tech.groups.yahoo.com/group/vimdev/message/51805 > > > > Actually I just tried minimal tagfunc, and it doesn't seem to do > > it, so it could be a fault with my script, although the link above > > shows that there's something wrong. Here's the minimal tagfunc I > > used: > > > > function! MyTagFunc(pattern, flags) > > return taglist(a:pattern) > > endfunc > > set tagfunc=MyTagFunc > > I haven't looked into it yet, but I was thinking whether this could be > related to the fact that you change the position of the cursor while > preparing a tag list. Well, I wonder that too, and it's possible. It's just that I reported that other bug referenced above (a year or so ago) which was very similar, and... bah, you know what, I just tried it again and now I can't get it to happen! It happens using my old mappings (before 'tagfunc') but isn't happening when using vim's tag commands. Forget it for now, I'll keep an eye out for it. Rob. -- Robert Webb <[email protected]>, Want to make polyhedra? http://www.software3d.com/Stella.php -- You received this message from the "vim_dev" 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
