title: Is it possible to make vim marks remember the relative position of the line in the current window?
body: <p>I'm using (a modified version) of the solution proposed in <a href="http://www.thegeekstuff.com/2008/12/vi-and-vim-autocommand-3-steps-to-add-custom-header-to-your-file/" rel="noreferrer">http://www.thegeekstuff.com/2008/12/vi-and-vim-autocommand-3-steps-to-add-custom-header-to-your-file/</a> to create and update headers for my source codes automatically.</p>
  
  <p>As explained in the above-mentioned page, upon invoking a <code>write</code> command in <code>vim</code>, the  following sequence of commands are executed:</p>
  
  <ol>
  <li>A mark is set at the current position of the file.</li>
  <li>The "Last Modified" filed is updated.  This moves the cursor to the beginning of the file (where the search-and-replace takes places).</li>
  <li>The cursor is returned to previously marked position.</li>
  </ol>
  
  <p>This is fine, but there is a slightly annoying issue:  Suppose we're editing a line close to the bottom of the window.  If at that point we save the file, because of the cursor moves (for updating the header) the line we were editing jumps so that it is positioned in the middle of the window.</p>
  
  <p>To my understanding <code>'a</code> moves the cursor to the place marked by mark <code>a</code> and adjusts the window contents such that the current line appears in the middle of the window.  I was wondering if there is a way to make "marks" remember also the exact relative position of the marked line in the window and maintain this position when jumping back to the mark?</p>