Linda W wrote:
A.J.Mechelynck wrote:
As has been repeatedly said this past week, this requires a viminfo setting and an autocommand.
----
    Maybe as has not been said.  I have all that.

The autocommand is defined near line 70 of $VIMRUNTIME/vimrc_example.vim so if you source the latter, you should have it.

I don't source example files by default.  But my system has a /etc/vimrc
and it does have the lines below, which appear to be equivalent if not the
same as what is in the example.  Perhaps vim no longer reads /etc/vimrc...?


" Only do this part when compiled with support for autocommands.
if has("autocmd")
  " 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

endif " has("autocmd")

" /etc/vimrc ends here



Type ":version". Near the middle of the output, there is a line saying "System vimrc file:". The file named on that line is sourced (in 'compatible' mode unless it sets 'nocompatible' itself) before your vimrc. The default is $VIM/vimrc (with neither dot nor underscore), on both Unix and Windows. If you don't have a file by that name, you can create it with (for a start) the following:

        if has("unix")
                source /etc/vimrc
        else
                runtime vimrc_example.vim
        endif

Another possibility is to source the vimrc_example near the beginning of your own vimrc; anything in /etc/vimrc that the vimrc_example lacks can be added after the invocation. (The only things which should come _before_ the invocation are "set nocompatible" if used, and anything which influences the menus, e.g. "language messages <languagename>".

The vimrc_example.vim contains a lot of useful settings. I recommend sourcing it from one's vimrc, then adding any desired tweaks as needed.

Oh, and I almost forgot: the command ":scriptnames" will tell you which scripts were sourced by the current instance of Vim, and in which sequence.


Best regards,
Tony.

Reply via email to