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

Paragraph motion issue/bug/feature

Expand Messages
  • Roy Rodenstein
    Vim is awesome! Now, a minor issue. Why does a line that s all whitespace (even just a single space) not count as a paragraph separator? If I have a b c and am
    Message 1 of 2 , Feb 6, 2000
      Vim is awesome!

      Now, a minor issue. Why does a line that's all whitespace (even just a
      single space) not count as a paragraph separator? If I have

      a


      b


      c


      and am below c, I expect '{' to take me below b, not above a. It looks
      like three paragraphs to humans, and I'm not sure why we wouldn't want
      lines with just a single space (or, perhaps, any whitespace, as long as
      the have _only_ whitespace) to separate paragraphs. Perhaps there's some
      functionality that relies on this (I suppose, when autoindent is on and
      one is coding, not treating blank-_looking_ lines as paragraph
      separators might be useful), but it seems from what I can tell that at
      least 90% of the time the user wants '{' to go up by what _looks like_ a
      paragraph. I know there is a 'paragraphs' variable, so this might
      already be solvable, but I don't know what to set it to (it'd have to be
      a regex, most likely) to make it separate paragraphs by whitespace-only
      lines.

      Did I mention that vim rules?! :D

      --
      li'l cow
      Roy Rodenstein /\_/\
      royrod@... ( o.o )
      > ^ <
    • Bram Moolenaar
      ... Nobody on this list would disagree with that. Perhaps try posting in an Emacs group and see what happens! :-) ... This is Vi compatible. All the good old
      Message 2 of 2 , Feb 9, 2000
        Roy Rodenstein wrote:

        > Vim is awesome!

        Nobody on this list would disagree with that. Perhaps try posting in an Emacs
        group and see what happens! :-)

        > Now, a minor issue. Why does a line that's all whitespace (even just a
        > single space) not count as a paragraph separator? If I have
        >
        > a
        >
        >
        > b
        >
        >
        > c
        >
        >
        > and am below c, I expect '{' to take me below b, not above a. It looks
        > like three paragraphs to humans, and I'm not sure why we wouldn't want
        > lines with just a single space (or, perhaps, any whitespace, as long as
        > the have _only_ whitespace) to separate paragraphs.

        This is Vi compatible. All the good old Vi commands are accurately reproduced
        by Vim. Unless it looks like a bug, but this isn't one.

        > Perhaps there's some functionality that relies on this (I suppose, when
        > autoindent is on and one is coding, not treating blank-_looking_ lines as
        > paragraph separators might be useful), but it seems from what I can tell
        > that at least 90% of the time the user wants '{' to go up by what _looks
        > like_ a paragraph. I know there is a 'paragraphs' variable, so this might
        > already be solvable, but I don't know what to set it to (it'd have to be a
        > regex, most likely) to make it separate paragraphs by whitespace-only lines.

        True. Now, there doesn't seem to be a Vim command that works like this. You
        can use "vap" to mark the paragraph, but you can't use "ap" as a movement
        command. Perhaps we should add "g{" and "g}" for this? If you really want,
        you could then map "{" to "g{" and "}" to "g}".

        --
        INSPECTOR END OF FILM: Move along. There's nothing to see! Keep moving!
        [Suddenly he notices the cameras.]
        INSPECTOR END OF FILM: (to Camera) All right, put that away sonny.
        [He walks over to it and puts his hand over the lens.]
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
        \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /
      Your message has been successfully submitted and would be delivered to recipients shortly.