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

Re: retain file mark

Expand Messages
  • Bram Moolenaar
    ... The problem is that the session file deletes all existing buffers, which is where the marks are remembered. This is actually a leftover from the idea that
    Message 1 of 17 , Jan 2, 2001
    • 0 Attachment
      Pritesh Mistry wrote:

      > any clues on how can i keep my file & position in that file even after
      > sourcing a session?
      >
      > what happens is that even if i use the file marks, i lose them in the
      > session that i have sourced, though they continue to be available in any
      > other sessions. has anybody found a nice way to deal with this!

      The problem is that the session file deletes all existing buffers, which is
      where the marks are remembered.

      This is actually a leftover from the idea that a session file should restore
      the buffer list as it was. In my opinion the user should not rely on the
      buffer list _not_ containing some buffers. If you want to have control over
      a list of files, use the argument list.

      I think restoring a session should not clear the buffer list, but only add new
      ones. Does anyone have a problem with that?

      *** ex_docmd.c~ Mon Jan 1 18:08:45 2001
      --- ex_docmd.c Tue Jan 2 13:52:45 2001
      ***************
      *** 9046,9054 ****
      #endif

      /*
      ! * Next a command to unload current buffers.
      */
      ! if (put_line(fd, "1,9999bd") == FAIL)
      return FAIL;

      /*
      --- 9046,9054 ----
      #endif

      /*
      ! * Close all windows but one.
      */
      ! if (put_line(fd, "only") == FAIL)
      return FAIL;

      /*

      --
      hundred-and-one symptoms of being an internet addict:
      172. You join listservers just for the extra e-mail.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    • Pritesh Mistry
      thanks a million bram, that did it! i ve commented that out. cheers, ... http://www.moolenaar.net ((( Creator of Vim - http://www.vim.org --
      Message 2 of 17 , Jan 2, 2001
      • 0 Attachment
        thanks a million bram, that did it!
        i've commented that out.

        cheers,


        > -----Original Message-----
        > From: Bram Moolenaar [mailto:Bram@...]
        > Sent: Tuesday, January 02, 2001 1:13 pm
        > To: Pritesh Mistry
        > Cc: vim@...
        > Subject: Re: retain file mark
        >
        >
        >
        > Pritesh Mistry wrote:
        >
        > > any clues on how can i keep my file & position in that file
        > even after
        > > sourcing a session?
        > >
        > > what happens is that even if i use the file marks, i lose
        > them in the
        > > session that i have sourced, though they continue to be
        > available in any
        > > other sessions. has anybody found a nice way to deal with this!
        >
        > The problem is that the session file deletes all existing
        > buffers, which is
        > where the marks are remembered.
        >
        > This is actually a leftover from the idea that a session file
        > should restore
        > the buffer list as it was. In my opinion the user should not
        > rely on the
        > buffer list _not_ containing some buffers. If you want to
        > have control over
        > a list of files, use the argument list.
        >
        > I think restoring a session should not clear the buffer list,
        > but only add new
        > ones. Does anyone have a problem with that?
        >
        > *** ex_docmd.c~ Mon Jan 1 18:08:45 2001
        > --- ex_docmd.c Tue Jan 2 13:52:45 2001
        > ***************
        > *** 9046,9054 ****
        > #endif
        >
        > /*
        > ! * Next a command to unload current buffers.
        > */
        > ! if (put_line(fd, "1,9999bd") == FAIL)
        > return FAIL;
        >
        > /*
        > --- 9046,9054 ----
        > #endif
        >
        > /*
        > ! * Close all windows but one.
        > */
        > ! if (put_line(fd, "only") == FAIL)
        > return FAIL;
        >
        > /*
        >
        > --
        > hundred-and-one symptoms of being an internet addict:
        > 172. You join listservers just for the extra e-mail.
        >
        > /// Bram Moolenaar -- Bram@... --
        http://www.moolenaar.net \\\
        ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      • Ron Aaron
        ... The idea of a session is that you can get back to the exact work-area you were at when you saved the session. If you do not remove the existing buffers,
        Message 3 of 17 , Jan 2, 2001
        • 0 Attachment
          Bram Moolenaar <Bram@...> writes:
          >Pritesh Mistry wrote:
          >
          >> any clues on how can i keep my file & position in that file even after
          >> sourcing a session?
          >>
          >> what happens is that even if i use the file marks, i lose them in the
          >> session that i have sourced, though they continue to be available in any
          >> other sessions. has anybody found a nice way to deal with this!
          >
          >The problem is that the session file deletes all existing buffers, which is
          >where the marks are remembered.
          >
          >This is actually a leftover from the idea that a session file should restore
          >the buffer list as it was. In my opinion the user should not rely on the
          >buffer list _not_ containing some buffers. If you want to have control over
          >a list of files, use the argument list.
          >
          >I think restoring a session should not clear the buffer list, but only add new
          >ones. Does anyone have a problem with that?

          The idea of a session is that you can get back to the exact work-area you were
          at when you saved the session. If you do not remove the existing buffers,
          this is not what will happen. I would not mind if you added an option to
          'mksession' which made it not remove all buffers first; but changing the way
          sessions currently work is IMHO not a good thing, because of all the people
          who rely on it working as it does now.

          Ron
        • W. Bruce Maguire II
          I agree with Ron s statement. A session should be the entire editing environment you had when you saved the session; no more, no less. Bruce. ... --
          Message 4 of 17 , Jan 2, 2001
          • 0 Attachment
            I agree with Ron's statement. A session should be the entire editing
            environment you had when you saved the session; no more, no less.

            Bruce.


            At 07:34 AM 1/2/01 -0800, Ron Aaron wrote:
            >Bram Moolenaar <Bram@...> writes:
            > >Pritesh Mistry wrote:
            > >
            > >> any clues on how can i keep my file & position in that file even after
            > >> sourcing a session?
            > >>
            > >> what happens is that even if i use the file marks, i lose them in the
            > >> session that i have sourced, though they continue to be available in any
            > >> other sessions. has anybody found a nice way to deal with this!
            > >
            > >The problem is that the session file deletes all existing buffers, which is
            > >where the marks are remembered.
            > >
            > >This is actually a leftover from the idea that a session file should restore
            > >the buffer list as it was. In my opinion the user should not rely on the
            > >buffer list _not_ containing some buffers. If you want to have control over
            > >a list of files, use the argument list.
            > >
            > >I think restoring a session should not clear the buffer list, but only
            > add new
            > >ones. Does anyone have a problem with that?
            >
            >The idea of a session is that you can get back to the exact work-area you were
            >at when you saved the session. If you do not remove the existing buffers,
            >this is not what will happen. I would not mind if you added an option to
            >'mksession' which made it not remove all buffers first; but changing the way
            >sessions currently work is IMHO not a good thing, because of all the people
            >who rely on it working as it does now.
            >
            >Ron

            --
            +---------------------+
            | W. Bruce Maguire II |
            | maguire@... |
            +---------------------+
          • Pritesh Mistry
            but, it isn t. it is only buffers, mappings, options, & gui. not the marks & registers! in that case why not keep the uppercase marks as well. cheers, ...
            Message 5 of 17 , Jan 2, 2001
            • 0 Attachment
              but, it isn't.

              it is only buffers, mappings, options, & gui. not the marks & registers! in
              that case why not keep the uppercase marks as well.

              cheers,


              -----Original Message-----
              From: W. Bruce Maguire II [mailto:maguire@...]
              Sent: Tuesday, January 02, 2001 3:55 pm
              To: vim@...
              Subject: Re: retain file mark


              I agree with Ron's statement. A session should be the entire editing
              environment you had when you saved the session; no more, no less.

              Bruce.


              At 07:34 AM 1/2/01 -0800, Ron Aaron wrote:
              >Bram Moolenaar <Bram@...> writes:
              > >Pritesh Mistry wrote:
              > >
              > >> any clues on how can i keep my file & position in that file even after
              > >> sourcing a session?
              > >>
              > >> what happens is that even if i use the file marks, i lose them in the
              > >> session that i have sourced, though they continue to be available in
              any
              > >> other sessions. has anybody found a nice way to deal with this!
              > >
              > >The problem is that the session file deletes all existing buffers, which
              is
              > >where the marks are remembered.
              > >
              > >This is actually a leftover from the idea that a session file should
              restore
              > >the buffer list as it was. In my opinion the user should not rely on the
              > >buffer list _not_ containing some buffers. If you want to have control
              over
              > >a list of files, use the argument list.
              > >
              > >I think restoring a session should not clear the buffer list, but only
              > add new
              > >ones. Does anyone have a problem with that?
              >
              >The idea of a session is that you can get back to the exact work-area you
              were
              >at when you saved the session. If you do not remove the existing buffers,
              >this is not what will happen. I would not mind if you added an option to
              >'mksession' which made it not remove all buffers first; but changing the
              way
              >sessions currently work is IMHO not a good thing, because of all the people
              >who rely on it working as it does now.
              >
              >Ron

              --
              +---------------------+
              | W. Bruce Maguire II |
              | maguire@... |
              +---------------------+
            • Pritesh Mistry
              okay, i think the problem i am having is: 1.if you don t re-write a session, you lose the file-marks that you had created prior to sourcing the session. 2.the
              Message 6 of 17 , Jan 2, 2001
              • 0 Attachment
                okay, i think the problem i am having is:

                1.if you don't re-write a session, you lose the file-marks that you had
                created
                prior to sourcing the session.

                2.the file-marks are available only if that buffer is available in the
                session.


                so, then:

                why lose the uppercase marks when they work perfectly fine & as expected,
                when
                not sourcing a session.

                I agree with Ron's concept of a session, but, why should that over-write
                _viminfo's uppercase file-marks! I am left with no choice but to go Bram's
                way
                and prevent deletion of the current buffer.

                I feel the best solution would be to allow navigation through uppercase
                file-mark, at the same time delete the current buffer. :-)

                cheers,



                -----Original Message-----
                From: Ron Aaron [mailto:ron@...]
                Sent: Tuesday, January 02, 2001 3:35 pm
                Subject: Re: retain file mark

                Bram Moolenaar <Bram@...> writes:
                >Pritesh Mistry wrote:
                >
                >> any clues on how can i keep my file & position in that file even after
                >> sourcing a session?
                >>
                >> what happens is that even if i use the file marks, i lose them in the
                >> session that i have sourced, though they continue to be available in any
                >> other sessions. has anybody found a nice way to deal with this!
                >
                >The problem is that the session file deletes all existing buffers, which is
                >where the marks are remembered.
                >
                >This is actually a leftover from the idea that a session file should
                restore
                >the buffer list as it was. In my opinion the user should not rely on the
                >buffer list _not_ containing some buffers. If you want to have control
                over
                >a list of files, use the argument list.
                >
                >I think restoring a session should not clear the buffer list, but only add
                new
                >ones. Does anyone have a problem with that?

                The idea of a session is that you can get back to the exact work-area you
                were
                at when you saved the session. If you do not remove the existing buffers,
                this is not what will happen. I would not mind if you added an option to
                'mksession' which made it not remove all buffers first; but changing the way
                sessions currently work is IMHO not a good thing, because of all the people
                who rely on it working as it does now.

                Ron
              • Bram Moolenaar
                ... In what way do you rely on a sesssion to delete existing buffers? I would think that a few extra buffers wouldn t get in the way of normal work. The
                Message 7 of 17 , Jan 2, 2001
                • 0 Attachment
                  Ron Aaron wrote:

                  > The idea of a session is that you can get back to the exact work-area you
                  > were at when you saved the session. If you do not remove the existing
                  > buffers, this is not what will happen. I would not mind if you added an
                  > option to 'mksession' which made it not remove all buffers first; but
                  > changing the way sessions currently work is IMHO not a good thing, because
                  > of all the people who rely on it working as it does now.

                  In what way do you rely on a sesssion to delete existing buffers? I would
                  think that a few extra buffers wouldn't get in the way of normal work. The
                  session also doesn't delete the command line history, for example (that's in
                  the viminfo file anyway).

                  --
                  hundred-and-one symptoms of being an internet addict:
                  176. You lie, even to user-friends, about how long you were online yesterday.

                  /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                  ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                  \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                • Bram Moolenaar
                  ... But part of the info is coming from the viminfo file. The original complaint was the marks in files were lost when loading a session file. These marks
                  Message 8 of 17 , Jan 2, 2001
                  • 0 Attachment
                    W. Bruce Maguire II wrote:

                    > I agree with Ron's statement. A session should be the entire editing
                    > environment you had when you saved the session; no more, no less.

                    But part of the info is coming from the viminfo file. The original complaint
                    was the marks in files were lost when loading a session file. These marks
                    come from the viminfo file.

                    Please don't expect the session file to restore everytying exactly how it was.
                    You will be disappointed. But it should restore enough to continue working
                    from when you saved the session.

                    --
                    hundred-and-one symptoms of being an internet addict:
                    183. You move your coffeemaker next to your computer.

                    /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                    ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                    \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                  • Ron Aaron
                    ... In my own session management scripts, I write to a session-specific viminfo file, just for this very reason. I do expect all current buffers to go away
                    Message 9 of 17 , Jan 3, 2001
                    • 0 Attachment
                      Bram Moolenaar <Bram@...> writes:
                      >W. Bruce Maguire II wrote:
                      >
                      >> I agree with Ron's statement. A session should be the entire editing
                      >> environment you had when you saved the session; no more, no less.
                      >
                      >But part of the info is coming from the viminfo file. The original complaint
                      >was the marks in files were lost when loading a session file. These marks
                      >come from the viminfo file.
                      >
                      >Please don't expect the session file to restore everytying exactly how it was.
                      >You will be disappointed. But it should restore enough to continue working
                      >from when you saved the session.

                      In my own session management scripts, I write to a session-specific viminfo
                      file, just for this very reason. I do expect all current buffers to go away
                      when I source a session...
                      Ron
                    • Pritesh Mistry
                      Could I please have a look at your session management scripts. ... complaint ... In my own session management scripts, I write to a session-specific viminfo
                      Message 10 of 17 , Jan 3, 2001
                      • 0 Attachment
                        Could I please have a look at your session management scripts.
                        ------------
                        Ron Aaron wrote:

                        >But part of the info is coming from the viminfo file. The original
                        complaint
                        >was the marks in files were lost when loading a session file. These marks
                        >come from the viminfo file.
                        >

                        In my own session management scripts, I write to a session-specific viminfo
                        file, just for this very reason. I do expect all current buffers to go away
                        when I source a session...
                        Ron
                      • Bram Moolenaar
                        ... Then you loose the command line history. You can chose to do this, of course. I see a difference between a Vim History and a Project state . Viminfo
                        Message 11 of 17 , Jan 3, 2001
                        • 0 Attachment
                          Ron Aaron wrote:

                          > In my own session management scripts, I write to a session-specific viminfo
                          > file, just for this very reason. I do expect all current buffers to go away
                          > when I source a session...

                          Then you loose the command line history. You can chose to do this, of course.
                          I see a difference between a "Vim History" and a "Project state". Viminfo
                          contains the "Vim History" and the Session the "Project state". Sort of.

                          I still wonder why you want existing buffers to disappear...

                          --
                          "You mean there really is an answer?"
                          "Yes! But you're not going to like it!"
                          "Oh do please tell us!"
                          "You're really not going to like it!"
                          "but we MUST know - tell us"
                          "Alright, the answer is...."
                          "yes..."
                          "... is ..."
                          "yes... come on!"
                          "is 42!"
                          (Douglas Adams - The Hitchhiker's Guide to the Galaxy)

                          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                          ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                        • Ron Aaron
                          ... Indeed you can! I have posted my *works only with 6.0r and later* version of my scripts here: http://www.mossbayeng.com/~ron/vim/ronstuff.zip unpack to a
                          Message 12 of 17 , Jan 4, 2001
                          • 0 Attachment
                            Pritesh Mistry <MPritesh@...> writes:
                            >Could I please have a look at your session management scripts.

                            >>Ron Aaron wrote:
                            >>In my own session management scripts, I write to a session-specific viminfo
                            >>file, just for this very reason. I do expect all current buffers to go away
                            >>when I source a session...
                            >>Ron

                            Indeed you can!

                            I have posted my *works only with 6.0r and later* version of my scripts here:

                            http://www.mossbayeng.com/~ron/vim/ronstuff.zip

                            unpack to a temp dir, and look at it.


                            The files in question are in the global/auto/sessmgr.vim directory. Note that
                            I dynamically load functions out of 'auto', and the code to do that is in my
                            startup. The layout is somewhat complicated, but it does what I want and
                            need.

                            NOTE: It is a work in progress - there are things which may need tweaking to
                            run in your environment.

                            Ron
                          • Kevin Werner
                            I m running gvim 5.7 on win2k. I downloaded the cygwin grep ver 2.4.2. I can t get the recursive options to work. It tries to open the directories and gets
                            Message 13 of 17 , Jan 4, 2001
                            • 0 Attachment
                              I'm running gvim 5.7 on win2k.

                              I downloaded the cygwin grep ver 2.4.2. I can't get the recursive options
                              to work. It tries to open the directories and gets permission denied for
                              each. Anyone else getting this to work.


                              Here are some ideas for gvim:

                              BUFFER MENU
                              Add an option which slects how the buffer sub-menus will be organized.
                              Right now they get grouped alphabetically if you have n buffers. Options
                              for group by extension or by directory would be cool. I've hacked something
                              together for extensions, but a more generic builtin option to do both would
                              better.

                              ~'s
                              Would it be possible to remove all of the ~'s at the bottom of the file when
                              using a gui? I think this would also make the scrollbar slider work a
                              little better/intuitively. Now, if you are editting a file with 24 lines in
                              a window with 25 lines, the slider is only 50% of the whole scrollbar.
                              Shouldn't it be 100% (no room to slide it), since we are seeing the whole
                              file? The ~'s aren't really needid in the gui since its easy to see where
                              the file ends by color.

                              PADDING
                              Would it be possible to have a "padding" opotion that works like the padding
                              on xterms? Basically, I'd like to stick a few white pixels between the
                              window frame and the text inside the window. Some characters up close to
                              the edge of the window are difficult to read because they are right next to
                              the window frame.

                              FUNCION NAME IN STATUS BAR
                              An option to insert the current function name into the status bar based on
                              the cursor position.


                              --
                              Kevin Werner
                              kwwerner@...
                            • Rafael Garcia-Suarez
                              ... If you don t like the ~ s, you can try (in your gvimrc) ... -- Rafael Garcia-Suarez
                              Message 14 of 17 , Jan 4, 2001
                              • 0 Attachment
                                Kevin Werner wrote:
                                >
                                > ~'s
                                > Would it be possible to remove all of the ~'s at the bottom of the file when
                                > using a gui? I think this would also make the scrollbar slider work a
                                > little better/intuitively. Now, if you are editting a file with 24 lines in
                                > a window with 25 lines, the slider is only 50% of the whole scrollbar.
                                > Shouldn't it be 100% (no room to slide it), since we are seeing the whole
                                > file? The ~'s aren't really needid in the gui since its easy to see where
                                > the file ends by color.

                                If you don't like the ~'s, you can try (in your gvimrc)
                                :hi NonText guifg=bg

                                --
                                Rafael Garcia-Suarez
                              • William Lee
                                On W2k you can use the findstr function for this purpose. It s already built in. I have the following in my .vimrc: if has( unix ) set grepprg=grep -n
                                Message 15 of 17 , Jan 5, 2001
                                • 0 Attachment
                                  On W2k you can use the "findstr" function for this purpose. It's
                                  already built in. I have the following in my .vimrc:

                                  if has("unix")
                                  set grepprg=grep\ -n
                                  else
                                  set grepprg=findstr\ /s\ /n\
                                  endif

                                  The "/s" option is to search recursively, "/n" is to show the line
                                  number besides the file name. Note that if you want to search for a
                                  string with multiple words you need to do a :grep /c:"This is a string"
                                  *.c instead of just :grep "This is a string" *.c (assuming you're
                                  search for files with .c extension). Otherwise it would return all the
                                  lines that match "This" or "is" or "a" or "string". It's pretty stupid,
                                  but it took me AGES to figure the "/c:" option out. Good luck.

                                  Will

                                  Kevin Werner wrote:
                                  >
                                  > I'm running gvim 5.7 on win2k.
                                  >
                                  > I downloaded the cygwin grep ver 2.4.2. I can't get the recursive options
                                  > to work. It tries to open the directories and gets permission denied for
                                  > each. Anyone else getting this to work.
                                  >
                                  > Here are some ideas for gvim:
                                  >
                                  > BUFFER MENU
                                  > Add an option which slects how the buffer sub-menus will be organized.
                                  > Right now they get grouped alphabetically if you have n buffers. Options
                                  > for group by extension or by directory would be cool. I've hacked something
                                  > together for extensions, but a more generic builtin option to do both would
                                  > better.
                                  >
                                  > ~'s
                                  > Would it be possible to remove all of the ~'s at the bottom of the file when
                                  > using a gui? I think this would also make the scrollbar slider work a
                                  > little better/intuitively. Now, if you are editting a file with 24 lines in
                                  > a window with 25 lines, the slider is only 50% of the whole scrollbar.
                                  > Shouldn't it be 100% (no room to slide it), since we are seeing the whole
                                  > file? The ~'s aren't really needid in the gui since its easy to see where
                                  > the file ends by color.
                                  >
                                  > PADDING
                                  > Would it be possible to have a "padding" opotion that works like the padding
                                  > on xterms? Basically, I'd like to stick a few white pixels between the
                                  > window frame and the text inside the window. Some characters up close to
                                  > the edge of the window are difficult to read because they are right next to
                                  > the window frame.
                                  >
                                  > FUNCION NAME IN STATUS BAR
                                  > An option to insert the current function name into the status bar based on
                                  > the cursor position.
                                  >
                                  > --
                                  > Kevin Werner
                                  > kwwerner@...
                                • Ron Aaron
                                  ... Use my port of grep, somewhere on my pages: http://www.mossbayeng.com/~ron/vim/vim.html the grep -r option works perfectly. Ron
                                  Message 16 of 17 , Jan 6, 2001
                                  • 0 Attachment
                                    Kevin Werner <kwwerner@...> writes:
                                    >I'm running gvim 5.7 on win2k.
                                    >
                                    >I downloaded the cygwin grep ver 2.4.2. I can't get the recursive options
                                    >to work. It tries to open the directories and gets permission denied for
                                    >each. Anyone else getting this to work.

                                    Use my port of grep, somewhere on my pages:

                                    http://www.mossbayeng.com/~ron/vim/vim.html

                                    the grep -r option works perfectly.

                                    Ron
                                  Your message has been successfully submitted and would be delivered to recipients shortly.