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

Restoring postion in a file

Expand Messages
  • Andrew Gacek
    How can I set up my .vimrc so that vim always opens a file to the place where it left the file. I know the .viminfo file can save this to mark 0, but that
    Message 1 of 3 , Sep 1, 2001
    • 0 Attachment
      How can I set up my .vimrc so that vim always opens a file to the place
      where it left the file. I know the .viminfo file can save this to mark 0,
      but that mark isn't jumped to automatially.

      Thanks for the help,
      Andrew
    • Eric Smith
      ... autocmd BufNewFile,BufRead * normal ` Then you can apply this selectively to certain file types but I like it so much I use it globally. -- Eric Smith
      Message 2 of 3 , Sep 2, 2001
      • 0 Attachment
        According to Andrew Gacek on Sun, Sep 02, 2001 at 12:35:10AM -0500:
        | How can I set up my .vimrc so that vim always opens a file to the place
        | where it left the file. I know the .viminfo file can save this to mark 0,
        | but that mark isn't jumped to automatially.
        autocmd BufNewFile,BufRead * normal `"

        Then you can apply this selectively to certain file types but I like
        it so much I use it globally.

        --
        Eric Smith
      • Benji Fisher
        ... Have a look at the last few lines in $VIMRUNTIME/vimrc_example.vim . A version of this autocommand is already there. In Vim 5.x, it is commented out,
        Message 3 of 3 , Sep 4, 2001
        • 0 Attachment
          Eric Smith wrote:
          >
          > According to Andrew Gacek on Sun, Sep 02, 2001 at 12:35:10AM -0500:
          > | How can I set up my .vimrc so that vim always opens a file to the place
          > | where it left the file. I know the .viminfo file can save this to mark 0,
          > | but that mark isn't jumped to automatially.
          > autocmd BufNewFile,BufRead * normal `"
          >
          > Then you can apply this selectively to certain file types but I like
          > it so much I use it globally.

          Have a look at the last few lines in $VIMRUNTIME/vimrc_example.vim . A
          version of this autocommand is already there. In Vim 5.x, it is commented
          out, because it messes with the jump stack. In Vim 6.0, g' and g` were added
          to avoid this problem, so it is not commented out.

          HTH --Benji Fisher
        Your message has been successfully submitted and would be delivered to recipients shortly.