7

Vim 8 has introduced the sign feature, that allows people to mark locations within a file.

I noticed there is a :sign jump command to jump to a sign, but it requires a buffer and an id as an argument, so as far as I could tell I would have to use :sign place to find out the sign id and then also know which file the sign belongs to.

Is there some combination of vimscript functions that allow me to jump to "the next sign" in some sense, similar to how :cn jumps to the next quickfix location? Alternatively, is there an easy way to fill quickfix with the sign locations?

4
  • Are you manually placing these signs, or are they being placed by plugins? Generally plugins that make use of signs have a function, mapping or command to jump to them.
    – ZeroKnight
    Commented Apr 6, 2018 at 23:54
  • @ZeroKnight Yeah, the plugin I'm asking this for does have such a feature, but it does it "manually" by filling the quickfix list whenever a new sign is placed. I'm just wondering if there's a more general solution. For instance, if I wrote my own plugin it would be silly of me to do all the hard work if there's a Vim feature I could rely on instead. Commented Apr 7, 2018 at 10:23
  • Right, I figured I'd ask for the sake of being thorough. I don't see anything in the help pages about jumping to signs outside of the jump command, so it seems to me that a plugin will be necessary.
    – ZeroKnight
    Commented Apr 8, 2018 at 1:31
  • You inspired me to write my first Vim plugin! It ought to do exactly what you're after. Please feel more than free to leave any feedback on the issue tracker.
    – ZeroKnight
    Commented Apr 21, 2018 at 6:25

1 Answer 1

3

Use SignJump. For whatever reason, Vim offers no way to quickly jump to tags outside of the horrendously unfriendly :sign jump command.

Once installed, simply use ]s and [s to jump to the next and previous sign relative to the cursor position. You can also use ]S and [S to jump to the first and last sign, respectively. It is general purpose and will jump to any sign.

Full Disclosure: I am the author of this plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.