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

Re: Can I indent more?

Expand Messages
  • Gary Johnson
    ... Besides the Align script, another, perhaps more straightforward way to move that second column is to use the blockwise-visual mode to insert a column of
    Message 1 of 4 , Apr 29, 2003
      On 2003-04-29, Saar Machtinger <SAARMA@...> wrote:
      > Hi,
      >
      > I have inside my C files, many declarations
      > e.g.
      > SUBNO_C_D (subscriber_no);
      > PRODTP_C_D (product_type);
      > SUBCSMSTS_C_D (sub_status);
      > DATE_C_D (sub_status_date);
      > DATE_C_D (init_activation_date);
      > parrfmind_t rfmArr;
      > SOC_C_D (old_pp);
      > DLRCD_C_D (dealer_code);
      >
      > How can I indent them so they will be:
      > SUBNO_C_D (subscriber_no);
      > PRODTP_C_D (product_type);
      > SUBCSMSTS_C_D (sub_status);
      > DATE_C_D (sub_status_date);
      > DATE_C_D (init_activation_date);
      > parrfmind_t rfmArr;
      > SOC_C_D (old_pp);
      > DLRCD_C_D (dealer_code);

      Besides the Align script, another, perhaps more straightforward way
      to move that second column is to use the blockwise-visual mode to
      insert a column of spaces and/or tabs in front of it. To do that,
      move the cursor to the '(' in the first line and type Ctrl-V. Then
      type 'j' enough times to highlight that column down to the last line
      of the declarations. Then type 'I' followed by enough spaces and/or
      tabs to indent the first line the way you want, then type Esc and
      voila, all the other lines will be indented the same way. See

      :help blockwise-visual

      If you are going to do this in a lot of places in your code, it
      might be worthwhile to use a substitute command instead, e.g.,

      :s/^\(\s*\S\+\s\+\)\(\S.*\)/\1 \2/

      where the spaces between the "\1" and the "\2" are inserted ahead of
      the second column in every line to which you apply the command. For
      example, you could use linewise-visual mode (entered by typing 'V')
      to select a set of declarations, then type the substitute command
      above starting with the ':'.

      HTH,
      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    Your message has been successfully submitted and would be delivered to recipients shortly.