Loading ...
Sorry, an error occurred while loading the content.

Inadequate functionality for sign related commands

Expand Messages
  • Hari Krishna Dara
    While using signs for my breakpts.vim script that I recently posted (which can be used to set breakpoints in vim functions), I have observed lack of
    Message 1 of 2 , Apr 1, 2003
    • 0 Attachment
      While using signs for my breakpts.vim script that I recently posted
      (which can be used to set breakpoints in vim functions), I have observed
      lack of functions/commands for doing certain things:

      - There are no functions to check if a sign is set. I had to search
      the output of "sign place" for the current line with the sign name
      for this. This is how I did it, if anyone is interested:

      >>>>
      function! s:CurLineHasSign()
      let signs = s:GetVimCmdOutput('sign place buffer=' . bufnr('%'), 1)
      return (match(signs,
      \ 'line=' . line('.') . '\s\+id=\d\+\s\+name=VimBreakPt') != -1)
      endfunction
      <<<<

      The s:GetVimCmdOutput() is nothing but a function which collects
      the output of an arbitrary vim command and return it and
      VimBreakPt is the name of my sign.

      - There are no commands to clear all the signs in a buffer/file or
      defined with a particular type. "sing unplace *" removes all signs
      and it doesn't take a buffer=<nr> option. I will have to get the
      output of "sign place" and unplace them individually, by searching
      for the appropriate signs, which is a pain.

      - In general I was puzzled by the fact that only the sign place
      command accepts name where as others don't. Is this a design flaw?

      Any comments?

      Thank you,
      Hari
    • Bram Moolenaar
      ... The sign funcionality has been designed to be used by a program or script. It s not something you type manually. ... You are supposed to keep a list of
      Message 2 of 2 , Apr 2, 2003
      • 0 Attachment
        Hari Krishna Dara wrote:

        > While using signs for my breakpts.vim script that I recently posted
        > (which can be used to set breakpoints in vim functions), I have observed
        > lack of functions/commands for doing certain things:

        The sign funcionality has been designed to be used by a program or
        script. It's not something you type manually.

        > - There are no functions to check if a sign is set. I had to search
        > the output of "sign place" for the current line with the sign name
        > for this. This is how I did it, if anyone is interested:

        You are supposed to keep a list of the placed signs yourself. This
        should not be too difficult, using a buffer-local variable.

        > - There are no commands to clear all the signs in a buffer/file or
        > defined with a particular type. "sing unplace *" removes all signs
        > and it doesn't take a buffer=<nr> option. I will have to get the
        > output of "sign place" and unplace them individually, by searching
        > for the appropriate signs, which is a pain.

        If you remember which signs have been placed, you know how to remove
        them. This does require using a loop, but that should not be too
        difficult.

        > - In general I was puzzled by the fact that only the sign place
        > command accepts name where as others don't. Is this a design flaw?

        The sign placement isn't simple, that is true. It was designed to be
        used by Sun Workshop and Netbeans. It's a little bit of puzzling, but I
        haven't found something useful that is not possible.

        --
        GUARD #1: What, ridden on a horse?
        ARTHUR: Yes!
        GUARD #1: You're using coconuts!
        ARTHUR: What?
        GUARD #1: You've got two empty halves of coconut and you're bangin' 'em
        together.
        The Quest for the Holy Grail (Monty Python)

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.