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

reordering buffers alphabetically?

Expand Messages
  • Peter Bismuti
    Sometimes I d like to reorder the buffer in alphabetical order after I ve read them in. Can this be done? Thx
    Message 1 of 5 , Apr 2, 2001
    • 0 Attachment
      Sometimes I'd like to reorder the buffer in alphabetical order after
      I've read them in. Can this be done?

      Thx
      _____________________________________________________________________
      | |
      | Pete Bismuti |
      | Department of Computer Science |
      | Florida State University |
      | bismuti@... (850) 644-6835 |
      |_____________________________________________________________________|
    • Benji Fisher
      ... These commands copy the output of the :ls command (the vim :ls, same as ... (unless you have more than 999 open), leaving you in an empty buffer, and then
      Message 2 of 5 , Apr 2, 2001
      • 0 Attachment
        Peter Bismuti wrote:
        >
        > Sometimes I'd like to reorder the buffer in alphabetical order after
        > I've read them in. Can this be done?
        >
        > Thx

        This should be possible with a vim script. Something along these lines:

        :redir @a
        :ls
        :redir END
        :1,999bdelete
        :put a

        These commands copy the output of the :ls command (the vim :ls, same as
        :buffers, not the shell command!) to the a register, delete all buffers
        (unless you have more than 999 open), leaving you in an empty buffer,
        and then copy the a register to that buffer. Now, you can process
        this buffer to get a list of file names, and sort it. See the :Sort
        command (and associated function) under :help eval-examples . Then,
        yank the whole buffer into the a register (:help :yank), and :bdelete
        this temporary buffer. Finally, I think you need an explicit loop to
        :edit each buffer on the list. I do not think there is a way to add a
        list of files to the buffer list. (Maybe in vim 6.0.) After extracting
        a single buffer name into bufname, you can

        :execute "e" bufname

        inside the loop.

        HTH --Benji Fisher
      • Thomas Köhler
        On Mon, Apr 02, 2001 at 12:22:39PM -0400, ... On unix, try ... This filters the file through the sort programm... Ciao, Thomas -- Thomas Köhler Email:
        Message 3 of 5 , Apr 2, 2001
        • 0 Attachment
          On Mon, Apr 02, 2001 at 12:22:39PM -0400,
          Peter Bismuti <bismuti@...> wrote:
          >
          > Sometimes I'd like to reorder the buffer in alphabetical order after
          > I've read them in. Can this be done?

          On unix, try

          :%!sort

          This filters the file through the sort programm...

          Ciao,
          Thomas

          --
          Thomas Köhler Email: jean-luc@... | LCARS - Linux
          <>< WWW: http://jeanluc-picard.de | for Computers
          IRC: jeanluc | on All Real
          PGP public key available from Homepage! | Starships
        • Peter Bismuti
          This doesn t work for me. I m running Redhat6.2 and Vim6.0w. I get an message saying 325 lines filtered .
          Message 4 of 5 , Apr 2, 2001
          • 0 Attachment
            This doesn't work for me. I'm running Redhat6.2 and Vim6.0w. I get an
            message saying "325 lines filtered".

            >
            >
            > --EeQfGwPcQSOJBaQU
            > Content-Type: text/plain; charset=iso-8859-1
            > Content-Disposition: inline
            > Content-Transfer-Encoding: quoted-printable
            >
            > On Mon, Apr 02, 2001 at 12:22:39PM -0400,
            > Peter Bismuti <bismuti@...> wrote:
            > >=20
            > > Sometimes I'd like to reorder the buffer in alphabetical order after
            > > I've read them in. Can this be done?
            >
            > On unix, try
            >
            > :%!sort
            >
            > This filters the file through the sort programm...
            >
            > Ciao,
            > Thomas
            >
            > --=20
            > Thomas K=F6hler Email: jean-luc@... | LCARS - Linux
            > <>< WWW: http://jeanluc-picard.de | for Computers
            > IRC: jeanluc | on All Real
            > PGP public key available from Homepage! | Starships
            >
            > --EeQfGwPcQSOJBaQU
            > Content-Type: application/pgp-signature
            > Content-Disposition: inline
            >
            > -----BEGIN PGP SIGNATURE-----
            > Version: GnuPG v1.0.4 (GNU/Linux)
            > Comment: For info see http://www.gnupg.org
            >
            > iD8DBQE6yNaNTEYXWMJlHuYRAkl0AJ9XxDGD1L580QrP6OcxXhm7nJN7gwCglz4I
            > qLgIstDfzhpWjPEu0kc/oXs=
            > =N6EQ
            > -----END PGP SIGNATURE-----
            >
            > --EeQfGwPcQSOJBaQU--
            >

            _____________________________________________________________________
            | |
            | Pete Bismuti |
            | Department of Computer Science |
            | Florida State University |
            | bismuti@... (850) 644-6835 |
            |_____________________________________________________________________|
          • Thomas Köhler
            On Mon, Apr 02, 2001 at 05:24:24PM -0400, ... Seems I ve misunderstood what you want :) Did you mean sort the buffer list or did you mean sort the contents
            Message 5 of 5 , Apr 2, 2001
            • 0 Attachment
              On Mon, Apr 02, 2001 at 05:24:24PM -0400,
              Peter Bismuti <bismuti@...> wrote:
              > > On Mon, Apr 02, 2001 at 12:22:39PM -0400,
              > > Peter Bismuti <bismuti@...> wrote:
              > > > Sometimes I'd like to reorder the buffer in alphabetical order after
              > > > I've read them in. Can this be done?
              > > On unix, try
              > >
              > > :%!sort
              > >
              > > This filters the file through the sort programm...
              > This doesn't work for me. I'm running Redhat6.2 and Vim6.0w. I get an
              > message saying "325 lines filtered".

              Seems I've misunderstood what you want :)
              Did you mean "sort the buffer list" or did you mean "sort the contents
              of the buffer"?
              The "sort" command above does the later, while sorting the buffer list
              is not possible in vim...

              Ciao,
              Thomas

              --
              Thomas Köhler Email: jean-luc@... | LCARS - Linux
              <>< WWW: http://jeanluc-picard.de | for Computers
              IRC: jeanluc | on All Real
              PGP public key available from Homepage! | Starships
            Your message has been successfully submitted and would be delivered to recipients shortly.