David Fishburn wrote:
Read http://vim.sourceforge.net/tips/tip.php?tip_id=80 , "Restore cursor to file position in previous editing session".


This tip does most of what I want thanks to the additional notes section.

I have realized, this only returns us to the row we were on.  Does anyone
know if it is also possible to return the the row and column position?

I am not sure if the column position is also stored within the viminfo file.

TIA,
Dave



The row and column are both stored as part of the mark. Just make sure you execute g`" where the first character after the g is a backtick. The vimrc_example.vim does it as follows:

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif


Best regards,
Tony.
--
Honesty pays, but it doesn't seem to pay enough to suit some people.
                -- F. M. Hubbard

Reply via email to