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

Autowrapping in Txt files

Expand Messages
  • Ven Tadipatri
    Hi, I set the tw option to 80, but it seems like the auto wrapping only works in a new vi buffer. When I try to open a txt file and set the tw, it does not
    Message 1 of 3 , Dec 12, 2012
    • 0 Attachment
      Hi,
      I set the tw option to 80, but it seems like the auto wrapping only works
      in a new vi buffer. When I try to open a txt file and set the tw, it does not
      automatically wrap. How do I get the autowrapping functionality to work with
      any file type?

      Thanks,
      Ven

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Gary Johnson
      ... There are two common meanings for the word wrap in this context. One refers to how a long line of text, with only one end-of-line sequence (LF or CR/LF)
      Message 2 of 3 , Dec 12, 2012
      • 0 Attachment
        On 2012-12-12, Ven Tadipatri wrote:
        > Hi,
        > I set the tw option to 80, but it seems like the auto wrapping only works
        > in a new vi buffer. When I try to open a txt file and set the tw, it does not
        > automatically wrap. How do I get the autowrapping functionality to work with
        > any file type?

        There are two common meanings for the word "wrap" in this context.
        One refers to how a long line of text, with only one end-of-line
        sequence (LF or CR/LF) at the end, will be displayed when it is too
        long to fit on a single line of the screen. The other refers to the
        insertion of end-of-line sequences into text so that the number of
        characters between pairs of end-of-line sequences (i.e., the line
        length) is limited.

        In the first case, Vim wraps long lines only at the right window
        boundary. How it wraps is controlled primarily by the 'wrap',
        'linebreak' and 'breakat' options. The 'tw' option has no effect on
        this.

        In the second case, the 'tw' option controls when Vim will insert a
        newline (the end-of-line sequence used internally) as text is typed
        or reformatted using the gq command. Vim does not automatically
        reflow or reformat text when you open a file, nor does it
        automatically reflow or reformat text when you change an option
        such as 'tw'. If you want some lines of text to be limited to a
        width of 'tw' or less, you need to reformat them with the gq
        command.

        This is explained more fully at

        :help usr_25.txt

        HTH,
        Gary

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Ben Fritz
        ... But it can reformat as you type. See :help formatoptions . -- You received this message from the vim_use maillist. Do not top-post! Type your reply
        Message 3 of 3 , Dec 12, 2012
        • 0 Attachment
          On Wednesday, December 12, 2012 10:07:05 AM UTC-6, Gary Johnson wrote:
          >
          > In the second case, the 'tw' option controls when Vim will insert a
          >
          > newline (the end-of-line sequence used internally) as text is typed
          >
          > or reformatted using the gq command. Vim does not automatically
          >
          > reflow or reformat text when you open a file, nor does it
          >
          > automatically reflow or reformat text when you change an option
          >
          > such as 'tw'. If you want some lines of text to be limited to a
          >
          > width of 'tw' or less, you need to reformat them with the gq
          >
          > command.
          >

          But it can reformat as you type. See :help 'formatoptions'.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.