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

more beautiful code

Expand Messages
  • Carlos Beltran
    Hello, Is it possible in vim to transform a piece of code like this... _params.m_Channels = channels; _params.m_SamplesPerSec = samplespersecond;
    Message 1 of 7 , Mar 3, 2004
    • 0 Attachment
      Hello,

      Is it possible in vim to transform a piece of code like this...

      _params.m_Channels = channels;
      _params.m_SamplesPerSec = samplespersecond;
      _params.m_BitsPerSample = bitspersample;
      _params.m_BufferLength = bufferlength;

      in a code where all the '=' are vertically aligned? Something like this...

      _params.m_Channels = channels;
      _params.m_SamplesPerSec = samplespersecond;
      _params.m_BitsPerSample = bitspersample;
      _params.m_BufferLength = bufferlength;

      Thanks

      Carlos
    • Alejandro Lopez-Valencia
      On Wednesday, March 03, 2004 6:37 AM, Carlos Beltran broke the silence ... http://vim.sourceforge.net/scripts/script.php?script_id=294
      Message 2 of 7 , Mar 3, 2004
      • 0 Attachment
        On Wednesday, March 03, 2004 6:37 AM, Carlos Beltran broke the silence
        of shunyata and uttered:

        > Hello,
        >
        > Is it possible in vim to transform a piece of code like this...


        http://vim.sourceforge.net/scripts/script.php?script_id=294
        http://vim.sourceforge.net/scripts/script.php?script_id=176
        http://vim.sourceforge.net/tips/tip.php?tip_id=319
      • Nikolai Weibull
        ... No, you could write a script for it, but remember a few things before you go ahead and change your code to look like this: 1. It will be more difficult to
        Message 3 of 7 , Mar 3, 2004
        • 0 Attachment
          * Carlos Beltran <cbeltran@...> [Mar 03, 2004 12:40]:
          > in a code where all the '=' are vertically aligned? Something like this...
          >
          > _params.m_Channels = channels;
          > _params.m_SamplesPerSec = samplespersecond;
          > _params.m_BitsPerSample = bitspersample;
          > _params.m_BufferLength = bufferlength;

          No, you could write a script for it, but remember a few things before
          you go ahead and change your code to look like this:

          1. It will be more difficult to edit your code if you change the
          names of any of your variables, and you'll have to realign if
          the longest is altered.
          2. You will have the normal space versus tab problems with the
          alignment handling.

          It looks good, but it causes some problems,
          nikolai

          --
          ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
          ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
          ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
          main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
        • A. S. Budden
          ... http://www.vim.org/scripts/script.php?script_id=294
          Message 4 of 7 , Mar 3, 2004
          • 0 Attachment
            Thus spake Nikolai Weibull:
            > * Carlos Beltran <cbeltran@...> [Mar 03, 2004 12:40]:
            > > in a code where all the '=' are vertically aligned? Something like this...
            > >
            > > _params.m_Channels = channels;
            > > _params.m_SamplesPerSec = samplespersecond;
            > > _params.m_BitsPerSample = bitspersample;
            > > _params.m_BufferLength = bufferlength;
            >
            > No, you could write a script for it, but remember a few things before
            > you go ahead and change your code to look like this:
            >
            > 1. It will be more difficult to edit your code if you change the
            > names of any of your variables, and you'll have to realign if
            > the longest is altered.
            > 2. You will have the normal space versus tab problems with the
            > alignment handling.
            >

            http://www.vim.org/scripts/script.php?script_id=294
          • Charles E. Campbell, Jr.
            ... Upgrading to vim 6.2 should address this. Regards, Chip Campbell
            Message 5 of 7 , Mar 3, 2004
            • 0 Attachment
              maoz wrote:

              > After installing scrip_id 294 i get the following errors.
              >
              >> http://www.vim.org/scripts/script.php?script_id=294
              >>
              >> Error detected while processing function AlignCtrl:
              >> line 10:
              >

              Upgrading to vim 6.2 should address this.

              Regards,
              Chip Campbell
            • Charles E. Campbell, Jr.
              ... Align.vim will do this (you ll need vim v6.2) (http://vim.sourceforge.net/scripts/script.php?script_id=294). With AlignMaps.vim (part of the Align.vim
              Message 6 of 7 , Mar 3, 2004
              • 0 Attachment
                Carlos Beltran wrote:

                >Hello,
                >
                >Is it possible in vim to transform a piece of code like this...
                >
                > _params.m_Channels = channels;
                > _params.m_SamplesPerSec = samplespersecond;
                > _params.m_BitsPerSample = bitspersample;
                > _params.m_BufferLength = bufferlength;
                >
                >in a code where all the '=' are vertically aligned? Something like this...
                >
                > _params.m_Channels = channels;
                > _params.m_SamplesPerSec = samplespersecond;
                > _params.m_BitsPerSample = bitspersample;
                > _params.m_BufferLength = bufferlength;
                >
                >

                Align.vim will do this (you'll need vim v6.2)
                (http://vim.sourceforge.net/scripts/script.php?script_id=294).
                With AlignMaps.vim (part of the Align.vim tarball), you may use
                visual-mode selection and then type
                \t= to align on the = signs. (also \T=).

                Also, you may find AutoAlign of interest...
                (http://vim.sourceforge.net/scripts/script.php?script_id=884).

                Regards,
                Chip Campbell
              • maoz
                ... After installing scrip_id 294 i get the following errors. ... -- Maoz Etziony 064-316364 maoz@windax.com
                Message 7 of 7 , Mar 3, 2004
                • 0 Attachment
                  A. S. Budden wrote:

                  >Thus spake Nikolai Weibull:
                  >
                  >
                  >>* Carlos Beltran <cbeltran@...> [Mar 03, 2004 12:40]:
                  >>
                  >>
                  >>>in a code where all the '=' are vertically aligned? Something like this...
                  >>>
                  >>> _params.m_Channels = channels;
                  >>> _params.m_SamplesPerSec = samplespersecond;
                  >>> _params.m_BitsPerSample = bitspersample;
                  >>> _params.m_BufferLength = bufferlength;
                  >>>
                  >>>
                  >>No, you could write a script for it, but remember a few things before
                  >>you go ahead and change your code to look like this:
                  >>
                  >> 1. It will be more difficult to edit your code if you change the
                  >> names of any of your variables, and you'll have to realign if
                  >> the longest is altered.
                  >> 2. You will have the normal space versus tab problems with the
                  >> alignment handling.
                  >>
                  >>
                  >>
                  >Hi,
                  >
                  >
                  After installing scrip_id 294 i get the following errors.

                  >http://www.vim.org/scripts/script.php?script_id=294
                  >
                  >Error detected while processing function AlignCtrl:
                  >line 10:
                  >E118: Too many arguments for function: visualmode
                  >E15: Invalid expression: visualmode(1)
                  >Error detected while processing function AlignCtrl..AlignCtrl:
                  >line 10:
                  >E118: Too many arguments for function: visualmode
                  >E15: Invalid expression: visualmode(1)
                  >E118: Too many arguments for function: visualmode
                  >E15: Invalid expression: visualmode(1)
                  >E118: Too many arguments for function: visualmode
                  >E15: Invalid expression: visualmode(1)
                  >
                  >Any idea?
                  >
                  --
                  Maoz Etziony
                  064-316364
                  maoz@...
                Your message has been successfully submitted and would be delivered to recipients shortly.