On Wednesday, June 27, 2012 3:17:07 PM UTC-5, Charles Campbell wrote:
> Ben Fritz wrote:
> > :help :sign-place says:
> >
> >             It's up to the user to make sure the {id} is used only once in
> >             each file (if it's used several times unplacing will also have
> >             to be done several times and making changes may not work as
> >             expected).
> >
> > While it is easy enough to ensure that any one given plugin does not
> > re-use signs, what is a good way to ensure that multiple plugins don't use
> > overlapping signs?
> >
> > I can check the redirected output of :sign place buffer={buffer number}
> > before I place any signs, but I'd guess not all plugin authors do this, so
> > they could clobber my signs fairly easily.
> >
> > Is this the recommended approach or is the problem mostly ignored?
> >
> >    
> May I suggest looking into my RltvNmbr plugin 
> (http://www.drchip.org/astronaut/vim/index.html#RLTVNMBR) and glancing 
> at its "s:AvoidOtherSigns()" function.
> 

Well, at least I know YOUR plugins won't clobber my signs :-)

It looks like s:AvoidOtherSigns finds the max sign ID currently in use and 
starts there. That should work fairly well.

The solution I ended up with, was to start at a sign ID equal to the return 
value of localtime(), and then whenever I define a new sign, check to see if 
the new ID I'm defining is already in use, and add 1 until I have one that is 
not.

I haven't release the plugin yet because I will need to patch the Vim source 
first; it's a plugin for manual diff alignment, but it depends on messing with 
the output of diff in the diffexpr, and Vim fails to parse the result because 
even though it follows the correct format, it doesn't match certain assumptions 
about things diff will output.

-- 
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

Reply via email to