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

Preserving buffers

Expand Messages
  • José Alves de Castro
    Hi, guys :-) I noticed that if I set a buffer (with q), I can exit vim, get in again, and the buffer is still defined. Here are my questions: 1) How strong is
    Message 1 of 7 , Nov 30, 2004
    • 0 Attachment
      Hi, guys :-)

      I noticed that if I set a buffer (with q), I can exit vim, get in again, and
      the buffer is still defined.

      Here are my questions:

      1) How strong is this persistence? Does it hold until the buffer is redefined,
      or is it a history type of thing?

      2) How can I define a buffer in .vimrc? The purpose would be that even if I
      accidentally redefine the buffer, it would be redefined again properly when
      restarting the editor.

      TIA, :-)

      jac

      --
      Jose Alves de Castro <cog@...>
      http://jose-castro.org/
    • José Alves de Castro
      ... Oops... wrong word, sorry :-| I believe the correct one is register , but now I m not so sure... I type something like qq (without the quotes) to start
      Message 2 of 7 , Nov 30, 2004
      • 0 Attachment
        On Ter, Nov 30, 2004 at 08:30:22 +0100, Joe Koenig wrote:
        > José Alves de Castro wrote:
        >
        > > I noticed that if I set a buffer (with q), I can exit vim, get in
        > > again, and the buffer is still defined.
        > [...]
        > > 2) How can I define a buffer in .vimrc?
        >
        > Sorry, but what does "set a buffer" (with "q"?) resp. "define a

        Oops... wrong word, sorry :-| I believe the correct one is "register", but now
        I'm not so sure...

        I type something like "qq" (without the quotes) to start "recording" it, type
        "q" again to stop, and then I can use something like "@q" to reuse the...
        register? :-|

        Sorry for the confusion :-) I hope I got it right this time :-)

        > buffer" mean? Are you talking about specific settings for a buffer?
        > An editing session? A file? Maybe
        >
        > :help ssop
        > :help mks
        > :help setl
        >
        > helps.

        --
        José Alves de Castro <cog@...>
        http://jose-castro.org/
      • Joe Koenig
        ... Ah, OK, that makes sense ;-) Yeah, well, register is already the right keyword. Just do ... and you ll see all the registers, currently occupied. So q
        Message 3 of 7 , Nov 30, 2004
        • 0 Attachment
          José Alves de Castro wrote:

          > Oops... wrong word, sorry :-| I believe the correct one is
          > "register", but now I'm not so sure...

          Ah, OK, that makes sense ;-)
          Yeah, well, "register" is already the right keyword. Just do

          :registers

          and you'll see all the registers, currently occupied. So

          "q

          would be the register used by "qq". For more info simply read ":help
          registers". You could also map these commands to some key (:help
          mapping) or put them into a function (:help function) which you'd call
          by ":call joses_own_function".

          Regarding the persistance: It's stored in ~/.viminfo (assuming a UNIX
          box on your side).
        • Antoine J. Mechelynck
          ... [...] Registers are saved in the viminfo file. See ... HTH, Tony.
          Message 4 of 7 , Nov 30, 2004
          • 0 Attachment
            On 30/11/2004 20:58, José Alves de Castro wrote:
            > On Ter, Nov 30, 2004 at 08:30:22 +0100, Joe Koenig wrote:
            >
            >>José Alves de Castro wrote:
            >>
            >>
            >>>I noticed that if I set a buffer (with q), I can exit vim, get in
            >>>again, and the buffer is still defined.
            >>
            >>[...]
            >>
            >>>2) How can I define a buffer in .vimrc?
            >>
            >>Sorry, but what does "set a buffer" (with "q"?) resp. "define a
            >
            >
            > Oops... wrong word, sorry :-| I believe the correct one is "register", but now
            > I'm not so sure...
            >
            > I type something like "qq" (without the quotes) to start "recording" it, type
            > "q" again to stop, and then I can use something like "@q" to reuse the...
            > register? :-|
            >
            > Sorry for the confusion :-) I hope I got it right this time :-)
            [...]

            Registers are saved in the viminfo file.

            See
            :help 'viminfo'
            :help viminfo-file

            HTH,
            Tony.
          • Mathias Michaelis
            Hi * ... Uups -- not so fast! With qq you start _not_ a register, but a keyboard makro. You end the recording of the makro by pressing a single q again. With
            Message 5 of 7 , Dec 1, 2004
            • 0 Attachment
              Hi *

              > Ah, OK, that makes sense ;-)
              > Yeah, well, "register" is already the right keyword. Just do
              >
              > :registers
              >
              > and you'll see all the registers, currently occupied. So
              >
              > "q
              >
              > would be the register used by "qq".
              >
              Uups -- not so fast! With qq you start _not_ a register, but a
              keyboard makro. You end the recording of the makro by pressing a
              single q again.

              With "qy<motion> you "yank" some text in the register q.

              With :registers you don't see the makro, but the text you yanked
              with "qy<motion>. However, the makro still exists, as @q prooves.

              Regards,
              Mathias
            • Antoine J. Mechelynck
              ... Not so fast, Mathias. With qq you start a keyboard macro which is stored in register q ( qa would store it in register a , qQ would append it to the
              Message 6 of 7 , Dec 1, 2004
              • 0 Attachment
                On 1/12/2004 11:58, Mathias Michaelis wrote:
                > Hi *
                >
                >
                >>Ah, OK, that makes sense ;-)
                >>Yeah, well, "register" is already the right keyword. Just do
                >>
                >> :registers
                >>
                >>and you'll see all the registers, currently occupied. So
                >>
                >> "q
                >>
                >>would be the register used by "qq".
                >>
                >
                > Uups -- not so fast! With qq you start _not_ a register, but a
                > keyboard makro. You end the recording of the makro by pressing a
                > single q again.
                >
                > With "qy<motion> you "yank" some text in the register q.
                >
                > With :registers you don't see the makro, but the text you yanked
                > with "qy<motion>. However, the makro still exists, as @q prooves.
                >
                > Regards,
                > Mathias
                >
                >
                >

                Not so fast, Mathias.

                With qq you start a keyboard macro which is stored in register q ( qa
                would store it in register a , qQ would append it to the existing
                contents of register q , etc.); ":registers" or ":echo @q" will then
                show your keyboard macro as the contents of register q ; and "qp will
                "put" that contents without interpretation.

                If, after starting a keyboard macro with qq and ending it with q , you
                yank something into register q with "qy<motion> , it replaces your
                keyboard macro with the yanked text.

                see
                :help q

                Regards,
                Tony.
              • Mathias Michaelis
                Hi Tony ... Indeed, I was too fast. Thanks for your adjustment. Mathias
                Message 7 of 7 , Dec 1, 2004
                • 0 Attachment
                  Hi Tony

                  > Not so fast, Mathias.
                  >
                  Indeed, I was too fast.
                  Thanks for your adjustment.
                  Mathias
                Your message has been successfully submitted and would be delivered to recipients shortly.