On 22/03/10 11:39, Jean Johner wrote:
Hello,
Please launch gvim easy (using vimrc_example.vim as .vimrc)
gvim -y file1
Put the cursor (|) at the end of line 10
Quit
Reopen by gvim -y file1
Result: The cursor is not at the end of line 10.
Is there a solution?

Best regards
Jean Johner


Either source the vimrc_example.vim, for instance by adding

runtime vimrc_example.vim

near the top of your vimrc, or at least add the following (from lines 80 or thereabouts in the example vimrc):

if has('autocmd')
 augroup vimrcEx
  " 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).
  " Also don't do it when the mark is in the first line, that is
  " the default position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif
 augroup END
endif

This will remember your cursor location for each file, even across sessions if your 'viminfo' setting is nonempty (see the ' [apostrophe] paragrapĥ under :help 'viminfo'). I _think_ that the 'insertmode' setting (characteristic of evim or [g]vim -y) is irrelevant for autocommands.

Use of continuation lines assumes that you're in 'nocompatible' mode (which is the default if your vimrc is named $HOME/.vimrc or $HOME/_vimrc).

If you _don't_ have +autocmd compiled-in, then sorry, you gotta get a more powerful version.


Best regards,
Tony.
--
"Calvin Coolidge looks as if he had been weaned on a pickle."
                -- Alice Roosevelt Longworth

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.

Reply via email to