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

37852Re: Patch to add the cbuffer command

Expand Messages
  • Yegappan Lakshmanan
    Oct 31, 2004
    • 0 Attachment
      Hi,

      --- Mikolaj Machowski <mikmach@...> wrote:

      > Dnia pi�tek, 29 pa�dziernika 2004 02:44, Yegappan Lakshmanan napisa�:
      > > Hi all,
      > >
      > > The attached patch (aginst the 6.3 sources) implements the
      > > ":cbuffer" command which feeds the contents of the current
      > > buffer to quickfix. This will allow us to copy and paste or
      > > read the output of any command into a Vim buffer and use
      > > the Vim quickfix feature to browse the output.
      > >
      > > Without this command, you have to save the output of the command
      > > to a file and use the ":cfile" or ":cgetfile" commands or the
      > > "-q" Vim argument to use the output.
      > >
      > > If there is some interest in this command, I will add the
      > > documentation.
      > >
      > Didn't test (no 6.3 sources) but:
      >
      > I like the idea but it would be even more useful if you could use it
      > with range, visual, etc. But maybe it is already possible? Or too much
      > bloat?
      >

      It is a small change to support ex ranges. The attached updated
      patch accepts an ex range (with line numbers, marks, etc) for
      the ":cbuffer" command.

      This command works only for the current buffer. Currently, it
      is not possible to specify a buffer name or buffer number to
      this command.

      - Yegappan
      -----------------------------------------------------------------
      *** ./ex_docmd.c.orig Thu Oct 28 20:24:57 2004
      --- ./ex_docmd.c Sun Oct 31 14:19:09 2004
      ***************
      *** 112,117 ****
      --- 112,118 ----
      static int getargopt __ARGS((exarg_T *eap));
      #ifndef FEAT_QUICKFIX
      # define ex_make ex_ni
      + # define ex_cbuffer ex_ni
      # define ex_cc ex_ni
      # define ex_cnext ex_ni
      # define ex_cfile ex_ni
      *** ./proto/quickfix.pro.orig Mon Jun 7 01:54:17 2004
      --- ./proto/quickfix.pro Sun Oct 31 14:00:44 2004
      ***************
      *** 14,19 ****
      --- 14,20 ----
      int bt_dontwrite_msg __ARGS((buf_T *buf));
      int buf_hide __ARGS((buf_T *buf));
      void ex_make __ARGS((exarg_T *eap));
      + void ex_cbuffer __ARGS((exarg_T *eap));
      void ex_cc __ARGS((exarg_T *eap));
      void ex_cnext __ARGS((exarg_T *eap));
      void ex_cfile __ARGS((exarg_T *eap));
      *** ./quickfix.c.orig Thu Oct 28 20:25:03 2004
      --- ./quickfix.c Sun Oct 31 14:17:59 2004
      ***************
      *** 2130,2135 ****
      --- 2130,2155 ----
      }

      /*
      + * ":cbuffer" command.
      + */
      + void
      + ex_cbuffer(eap)
      + exarg_T *eap;
      + {
      + FILE *f;
      +
      + char_u *tmp = vim_tempname('c');
      +
      + buf_write(curbuf, tmp, NULL, eap->line1, eap->line2,
      + NULL, FALSE, FALSE, FALSE, TRUE);
      +
      + qf_init(tmp, p_efm, TRUE);
      +
      + mch_remove(tmp);
      + vim_free(tmp);
      + }
      +
      + /*
      * ":helpgrep {pattern}"
      */
      void
      *** ./ex_cmds.h.orig Thu Oct 28 20:24:47 2004
      --- ./ex_cmds.h Sun Oct 31 14:18:54 2004
      ***************
      *** 190,195 ****
      --- 190,197 ----
      RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
      EX(CMD_catch, "catch", ex_catch,
      EXTRA|SBOXOK|CMDWIN),
      + EX(CMD_cbuffer, "cbuffer", ex_cbuffer,
      + RANGE|DFLALL|TRLBAR),
      EX(CMD_cc, "cc", ex_cc,
      RANGE|NOTADR|COUNT|TRLBAR|BANG),
      EX(CMD_cclose, "cclose", ex_cclose,



      __________________________________
      Do you Yahoo!?
      Yahoo! Mail Address AutoComplete - You start. We finish.
      http://promotions.yahoo.com/new_mail
    • Show all 10 messages in this topic