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

Re: autoindent: spaces and tabs

Expand Messages
  • Y. Hida
    ... Thanks! I didn t know about copyindent option. In retrospect, I should haved grepped the vim help files before asking. -Yozo
    Message 1 of 5 , Apr 30 11:16 PM
    • 0 Attachment
      On 2009-05-01, StarWing <weasley_wx@...> wrote:
      > On 5月1日, 上午4时36分, "Y. Hida" <eigensol...@...> wrote:
      >> Hi,
      >>
      >> I have a question regarding auto-indenting. Suppose I have a line
      >> whose indent is a mix of tabs and spaces, like following:
      >>
      >> ____....blah blah
      >>
      >> where ____ is a tab and . is a space. When I insert a new line after
      >> this vim either inserts only tabs, so I get
      >>
      >> ____....blah blah
      >> ________
      >>
      >> Is there a way to just copy the indentation so that I get something
      >> like:
      >>
      >> ____....blah blah
      >> ____....
      >>
      >> instead? I like using this kind of indenting to give flexibility to
      >> adjust tab widths without messing up other alignments, so that I can do
      >> something like
      >>
      >> ____void func(some very long arguments,
      >> ____..........more arguments aligned
      >> ____..........even more arguments aligned)
      >>
      >> without manually fixing the indentations each time.
      >>
      >> -Yozo
      >
      > see :h 'ci', you will find the answer:-)

      Thanks! I didn't know about copyindent option. In retrospect, I should
      haved grepped the vim help files before asking.

      -Yozo




      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Matt Wozniski
      ... ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more information, visit
      Message 2 of 5 , May 1, 2009
      • 0 Attachment
        On Fri, May 1, 2009 at 2:16 AM, Y. Hida wrote:
        >
        > On 2009-05-01, StarWing wrote:
        >> On 5月1日, 上午4时36分, "Y. Hida" wrote:
        >>> Hi,
        >>>
        >>>   I have a question regarding auto-indenting.  Suppose I have a line
        >>> whose indent is a mix of tabs and spaces, like following:
        >>>
        >>> ____....blah blah
        >>>
        >>> where ____ is a tab and . is a space.  When I insert a new line after
        >>> this vim either inserts only tabs
        >>
        >> see :h 'ci', you will find the answer:-)
        >
        > Thanks!  I didn't know about copyindent option.  In retrospect, I should
        > haved grepped the vim help files before asking.

        :help 'preserveindent' might also be useful to you.

        ~Matt

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Y. Hida
        ... Thanks, but it doesn t seem too useful for me. For example, (again ____ are tabs and . are spaces): void foo(int a, .........int b, .........int c) and
        Message 3 of 5 , May 1, 2009
        • 0 Attachment
          On 2009-05-01, Matt Wozniski <mjw@...> wrote:
          >
          > On Fri, May 1, 2009 at 2:16 AM, Y. Hida wrote:
          >>
          >> On 2009-05-01, StarWing wrote:
          >>> On 5月1日, 上午4时36分, "Y. Hida" wrote:
          >>>> Hi,
          >>>>
          >>>>   I have a question regarding auto-indenting.  Suppose I have a line
          >>>> whose indent is a mix of tabs and spaces, like following:
          >>>>
          >>>> ____....blah blah
          >>>>
          >>>> where ____ is a tab and . is a space.  When I insert a new line after
          >>>> this vim either inserts only tabs
          >>>
          >>> see :h 'ci', you will find the answer:-)
          >>
          >> Thanks!  I didn't know about copyindent option.  In retrospect, I should
          >> haved grepped the vim help files before asking.
          >
          >:help 'preserveindent' might also be useful to you.

          Thanks, but it doesn't seem too useful for me. For example,
          (again ____ are tabs and . are spaces):

          void foo(int a,
          .........int b,
          .........int c)

          and doing >> results in

          ____void foo(int a,
          .........___.int b,
          .........___.int c)

          Note the tab character is inserted in the middle of spaces. Instead, I
          would like it to do

          ____void foo(int a,
          ____.........int b,
          ____.........int c)

          Now if a do << on that above text block, I get

          void foo(int a,
          ____.....int b,
          ____.....int c)

          instead of the original

          void foo(int a,
          .........int b,
          .........int c)

          But this doesn't annoy me as much as the original issue I had, since I
          can always remap << and >> to delete/insert tabs at the beginning of the
          line.

          Is preserveindent really useful for anyone?

          Thanks,
          -Yozo



          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.