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

-S: Restoring cursor position doesn't work anymore with this command line option

Expand Messages
  • Mathias Michaelis
    VIM 6.3.62 WINDOWS XP SP 2 Hello * In my _vimrc file I have autocmd BufReadPost * if line( ) 0 && line( )
    Message 1 of 1 , Mar 2, 2005
    • 0 Attachment
      VIM 6.3.62 WINDOWS XP SP 2

      Hello *

      In my _vimrc file I have

      autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$") |
      \ exe "normal g`\"" |
      \ endif

      to restore the position within a file since the last edit. And this
      normally works fine.

      But if I call vim as

      touch somefile.vim
      vim -S somefile.vim sometext.txt

      then the cursor jumps to line 1 instead of the line that was last
      edited. Only the column is restored correctly.

      Is this a bug or a feature?

      (My work around: Put the lines

      if line("'\"") > 0 && line("'\"") <= line("$") |
      \ exe "normal g`\"" |
      \ endif

      in any one of the vim scripts that appears in some -S argument).

      With kind regards
      Mathias
    Your message has been successfully submitted and would be delivered to recipients shortly.