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

Re: make 'gq' not join lines

Expand Messages
  • Ben Schmidt
    ... Interestingly, this exact version doesn t work for me. It seems Vim computes the line numbers of the range and then sticks to them even though the text
    Message 1 of 4 , May 29, 2008
    • 0 Attachment
      >> I'm looking for a way to prevent 'gq' from joining lines. I'd
      >> like to know whether there's a way to make it only wrap long
      >> lines without joining any lines.
      >
      > The times that I've wanted to do this, I often use
      >
      > :%norm gqq
      >
      > where "%" is whatever range (often "'<,'>") I want to perform
      > this on.

      Interestingly, this exact version doesn't work for me. It seems Vim computes the
      line numbers of the range and then sticks to them even though the text grows by
      virtue of the normal command, thus it stops at the line number which would have
      been the last line in the buffer before the command was executed, but now isn't,
      so part of the buffer is left unprocessed.

      The same happens when using marks such as '<,'>.

      Do you see that behaviour?

      Perhaps this qualifies for the todo list, Bram?

      > Alternatively, it works nicely with the :g and :v
      > commands

      It does work as

      :g/^/norm gqq

      (I just picked ^ as I knew it would match on every line). I guess the g command is
      smarter because it expects that a changing number of lines is a common use case so
      it's been accounted for.

      Ben.




      --~--~---------~--~----~------------~-------~--~----~
      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.