Yakov Lerner wrote:
On 7/10/06, dave--uk <[EMAIL PROTECTED]> wrote:
2) when i edited a file, vim remembered the last position I was at
For this to work, you need certain definitions in your ~/.vimrc.
1) You need some definition for 'viminfo' option, for example:
set viminfo='20,<50,s10,:20,h
( does not need to be exactly like this. See :help 'viminfo')
2) You need specific BufReadPost autocommand in your ~/.vimrc,
which looks like this:
:au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe
"normal g'\"" | endif
or like this:
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
or like this:
if has("autocmd")
"...
augroup vimrcEx
au!
"...
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" ...
endif
Yakov
... and you also need an executable which can handle autocommands and
expression evaluation. On Redhat-like systems, there may be up to three
Vim executables per version on a single system:
"/bin/vi", from the vim-minimal rpm, a bare-bones "tiny version" Vim
with no autocommands, no arithmetic evaluation, no syntax highlighting,
nothing at all that can be omitted at compile-time. This executable is
guaranteed to be on a mounted filesystem even when booting for
"emergency repairs" in syngle-user mode. Being mounted even at runlevel
1 or S is its sole redeeming feature IMHO.
"/usr/bin/vim", from the vim-enhanced rpm, a "big" version without GUI.
This one will be available in multiuser runlevels even if X11 isn't up
(as in runlevels 2 or 3)
"/usr/X11R6/bin/gvim", from the vim-X11 rpm, a "big" or "huge" version
with GUI enabled. This one is particularly useful at runlevel 5
(multiuser with X11).
Best regards,
Tony.